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.
Move files with date as parameter
Name: nagendraG Date: June 16, 2008 at 08:56:30 Pacific OS: xp CPU/Ram: intel core duo Product: 2002
Comment:
Hi All,
I have to move the files from one folder to other folder based on the date.
For example in Folder A i will have .txt from jan 2007.I need to use a .bat script to which i should pass the date as parameter (YYYYMMDD is the date format ).., to move files for that particular date.
If for 20080514 i have 14 files i will pass this date as parameter to the .bat script which should move all the 14 files from c:\old to c:\new folder .
Hope i am clear...
Pls suggest how can i write .bat for this requirement.
Name: nagendraG Date: June 16, 2008 at 08:58:31 Pacific
Reply:
My files will have timestamped attached as below. abc_20080401112344.txt abc_20080517135422.txt
Thanks, Nagendra
0
Response Number 2
Name: klint Date: June 16, 2008 at 10:32:07 Pacific
Reply:
@echo off set /p dat=Enter date as YYYYMMDD: copy c:\old\abc_%dat%*.txt c:\new
0
Response Number 3
Name: nagendraG Date: June 16, 2008 at 12:59:25 Pacific
Reply:
Thanks for your quick response klint...
But i need to pass the date as parameter to the batch file..say for example my bat script is test.bat...then i have to pass the date as below. test.bat 20080616 because the date is a dynamic one generated by our source application...we will parametrize the date value so that we can schedule the job.
Pls suggest a way for this.
Thanks, Nagendra
0
Response Number 4
Name: Shr0Om Date: June 16, 2008 at 13:41:41 Pacific
Reply:
This should do the trick (test.bat 20080616)
@echo off set dat=%1% copy c:\old\abc_%dat%*.txt c:\new
0
Response Number 5
Name: Ravi_varma Date: June 17, 2008 at 02:05:55 Pacific
Reply:
I tried to move the files between share drives i.e from one share drive to another in the same network using the batch script but it is giving an error file not found
Summary: hello, i am moving files with a batch and scheduled tasks. is there a way to select a specific # of files instead of all the say *.html files in a directory? the string i am using is move /-y *.html ...
Summary: If you use the 'current' system date, you will always have to run the program 'today' or the file date would never match. A better solution would be to input the desired date. I use a compiled BASI...
Summary: hi there i'm only learning to write batches and have a problem with one that i can't get to run as i want it to: i have 2 folders: C:\Folder1 and C:\Folder2 in Folder1 there is one *.txt and lots of *...