Moving folders with wildcard

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Moving folders with wildcard

Post by rullbandspelare » Sun Jan 21, 2007 9:17 pm

Hi I can not figure out how to move a bunch of folders to a BACKUP folder.

I have a bunch of folders named something like
070119_12.13-14.12
070114_13.13-15.23
070113_15.13-22.54
070112_14.13-23.33
BACKUP
SHORTCUT.lnk

I whant to move all the 0701...... folders to the BACKUP folder. Just keeping the BACKUP and shortcut in the root.

I have a hard time getting wildcard (*) to work with directory handling.

Thanks!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 22, 2007 2:32 pm

I always use DOS for file handling. try something like this:

Let>RP_WAIT=1
Run>cmd /c dir 0701* /ad /b > %TEMP_DIR%dirlist.txt
Let>k=0
Label>start
add>k,1
ReadLn>%TEMP_DIR%dirlist.txt,%k%,line
If>%line%=##EOF##,done
Run>cmd /c xcopy "[drive]:\path\%line%" "[drive]:\path\" /E /C /Y
Goto>start

Label>done
DeleteFile>%TEMP_DIR%dirlist.txt


Check the parameters for "xcopy" to make sure that they meet your requirements. Do this by opening a DOS window and typing xcopy /?

This script has not been tested there might be typos.

Hope this is helpful,
Dick

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts