Computing.Net > Forums > Disk Operating System > Test File Name

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Test File Name

Reply to Message Icon

Name: freediver211
Date: July 23, 2007 at 08:21:12 Pacific
OS: Windows XP
CPU/Ram: N/A
Product: N/A
Comment:

I have this DOS batch script that searches a folder for files and folders and moves those files and folders to another folder.
This script is called by a separate application.
What I need to do is modify my script to search the file name and if the file name has a flag in it then don't move that file. For example, if the file name has an extension of "_dontmoveme" I don't want to the move the file (ex. "file123_dontmoveme").

:: OLD SCRIPT:
:: Search directory for folder and file names.
for /f "tokens=* delims=" %%x in ('dir %INPUT_FOLDER% /b/ad') do move %INPUT_FOLDER%"%%x" %OUTPUT_FOLDER%

What I would like to do:
:: Search directory for folder and file names.
for /f "tokens=* delims=" %%x in ('dir %INPUT_FOLDER% /b/ad') do NewMethod


NewMethod
if (%%x NOT Contain "_dontmoveme")
do move %INPUT_FOLDER%"%%x" %OUTPUT_FOLDER%
else
do nothing


Any suggestions?


Thanks in advance!




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 23, 2007 at 09:09:07 Pacific
Reply:

I dunno how to move directories, but I guess you do.

To strip out the ones to leave alone, change this:

('dir %INPUT_FOLDER% /b/ad')

to this:

('dir %INPUT_FOLDER% /b/ad ^|find /v "_dontmoveme"')


=====================================
If at first you don't succeed, you're about average.

M2



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Test File Name

Making a file name include date www.computing.net/answers/dos/making-a-file-name-include-date/13859.html

copying tool which does long file names www.computing.net/answers/dos/copying-tool-which-does-long-file-names/6605.html

Batch File - Create new File Name www.computing.net/answers/dos/batch-file-create-new-file-name/11927.html