need to move files that always have different names?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
IXIS

need to move files that always have different names?

Post by IXIS » Fri Aug 13, 2004 4:21 am

I have a network of remote servers that always dumps audio files in to a certain directory every six hours. How would I go about moving those files to a new directory before the next shipment arrives if the file names always change. Each new file that is delivered is named with a timestamp.

sorry if it seems elementary... first crack at this.

Lumumba

Post by Lumumba » Fri Aug 13, 2004 5:59 am

What about DOS' XCOPY & AT commands ?
RunProgram>cmd /c xcopy C:\*.mp3 d:\*.mp3 /1stparam /2ndparam /...
command=W9x/ME
cmd=WinNT/W2K/XP


XCOPYsource [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
[/EXCLUDE:file1[+file2][+file3]...]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set,
doesn't change the attribute.
/M Copies only files with the archive attribute set,
turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. When any of the
strings match any part of the absolute path of the file to be
copied, that file will be excluded from being copied. For
example, specifying a string like \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/N Copies using the generated short names.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

---------------------------------

The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or month.
If date is omitted, the current day of the month is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday).
If date is omitted, the current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.

IXIS

Post by IXIS » Sat Aug 14, 2004 10:51 pm

Thanks for all the help! :D I got it to work your way and then ended up changing the whole idea anyway, but your input really opened my eyes to a lot things. Awsome!

One thing i'm having trouble with now though is creating new directorys with a datestamp or day for the name. I need to create one new datestamped folder each day to receive all the files for the day. Any ideas? :roll:

Lumumba

Post by Lumumba » Sun Aug 15, 2004 3:27 pm

Let>Drive= D:
Month>MM
Day>MD

IfDirExists>%Drive%\%MM%\%MD%,CopyFiles
RunProgram>cmd /c md %Drive%\%MM%\%MD%

Label>CopyFiles
.
.
.

IXIS

Post by IXIS » Tue Aug 17, 2004 5:33 pm

Thanks for all the help! Really usefull. :P

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