Solved

Batch job

Posted on 2004-10-25
269 Views
Last Modified: 2012-05-05
I created batch job which I need to delete certain files with extension *.chg.Those files are located on "H" partition.This what I have :
rem This will delete all .chg files
C:\cd\
H:
del :*.chg /s
When I try to run this job the batch job is not performing like it should...Any idea where is the problem
0
Question by:mirekg
    5 Comments
     
    LVL 24

    Expert Comment

    by:Dufo G. Belski
    What is C:\cd\ supposed to do?  Try remming that line out and just go with

    H:
    del :*.chg /s
    0
     
    LVL 11

    Expert Comment

    by:elbereth21
    I would recommend trying every line oh the batch in a DOS shell, anyhow, I think that your colon is unnecessary; try using:
    del *.chg /s
    0
     
    LVL 24

    Expert Comment

    by:Dufo G. Belski
    Oops, good point, elbereth21.
    0
     
    LVL 11

    Accepted Solution

    by:
    Sadly, that is the kind of mistakes I make in my own batch files... :-)
    0
     
    LVL 22

    Expert Comment

    by:DanCh99
    you also might want to consider the FORFILES.EXE server resource kit tool

    example:
    FORFILES -ph:\ -s -m*.chg -c"CMD /C del @FILE"

    -p = path
    -s = include subdirs
    -m = match filetype
    -d = age in days (can also be set as an absolute date ie DDMMYYYY)
    -c = command to execute

    Note there are no spaces between the switches and their arguments.

    info here:
    http://www.jsiinc.com/SUBL/tip5600/rh5645.htm
    Download it here:
    http://www.dynawell.com/support/ResKit/winnt.asp
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    With the shift in today’s hiring climate (http://blog.experts-exchange.com/ee-blog/5-tips-on-succeeding-in-the-new-gig-economy/?cid=Blog_031816), many companies are choosing to hire freelancers to get projects completed efficiently and inexpensively…
    Want to pick and choose which updates you receive? Feel free to check out this quick video on how to manage your email notifications.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now