👤
Home Man
Search
Today's Posts
Register

All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

Move all files with pattern in filename

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 12-28-2012
Move all files with pattern in filename

Well.

I would love to have a way to:

1.) search a folder, lets say: X:\Files
for any file that contains a "Conflict" in its filename (only!)
(recursively so it searches the whole contents of the folder)
2.) Move all files to another Folder.

All this under DOS.

Any help is appreciated.
# 2  
Old 12-28-2012
The built in windows command Find or FindStr mirrors the capabilities of the Unix command Grep.

'dir /B /S' will list all the files, and I gues /A-D to avoid directories.

I guess you could put them in a file and drive edit to convert the file into a bat full of copy commands.

You could get CygWin or the msdos gnu-like commands. UNIX Command Line Tools For MS-Windows XP / Vista / 7 Operating Systems

Last edited by DGPickett; 12-28-2012 at 03:57 PM..
# 3  
Old 12-28-2012
Ok, so supposing I listed the files the way you said...

What would I then need to add in order to move the found files to another dir ?

xargs doesn't exist under windows so...
# 4  
Old 12-28-2012
To ensure reliability, copy one file per line:
Code:
copy <original_line> target_dir

Cygwin definitely has xargs and bash while read. I am not sure how close the others get. I bet you could put Cygwin on a flash drive and run it anywhere, despite the registry. Cygwin is essentially invoked as bash and everything unix-like happens inside there. Cygwin installs pretty simply if you have broadband. I use it a lot.
# 5  
Old 12-28-2012
So essentially what you are saying is:

The thing I want to do is not possible under windows alone without cygwin ?

Meh too bad.

Thanks anyways.
# 6  
Old 12-29-2012
You can get busybox for windows which will have most of the usual commands contained in one exe file. No installation necessary at all.
The Following User Says Thank You to Corona688 For This Useful Post:
DGPickett (12-31-2012)
# 7  
Old 12-31-2012
Never say never. Driving edit with script might work. PERL is another direction that can help, but that's pretty close to going with VB, C, C++, JAVA. Busybox looks very interesting: BusyBox - The Swiss Army Knife of Embedded Linux

I got the w32 binary version of busybax, and it works really nice: http://dl.dropbox.com/u/5943991/busybox-w32/busybox.exe

Last edited by DGPickett; 01-02-2013 at 09:11 AM.. Reason: expans
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Delete files based on specific MMDDYYYY pattern in filename shankar1dada Shell Programming and Scripting 4 08-11-2011 11:50 PM
Move all files from source to destination directory based on the filename chetancrsp18 Shell Programming and Scripting 1 07-20-2011 03:23 AM
move files according to dated filename igmox UNIX for Dummies Questions & Answers 2 05-03-2011 07:21 AM
Move files based on date in filename slatoms Shell Programming and Scripting 7 06-25-2010 09:20 PM
want to move files in a dir into different directories based on the filename Sriranga Shell Programming and Scripting 4 03-10-2010 05:27 AM
want to move files in a dir into different directories based on the filename Sriranga UNIX for Dummies Questions & Answers 2 03-10-2010 04:49 AM
move filenames with to another filename without the last character ~ ayhanne Shell Programming and Scripting 3 01-20-2009 10:10 AM
Script to move files based on Pattern don't work osramos Shell Programming and Scripting 1 10-22-2008 12:15 AM
how to move files into different folders based on filename italia5 UNIX for Dummies Questions & Answers 7 08-23-2006 10:04 AM


All times are GMT -4. The time now is 06:03 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password