Home / Microsoft / Microsoft DOS / shedule time for copy/transfer folders job
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2  All - (Bottom) Print
Author Topic: shedule time for copy/transfer folders job  (Read 1854 times)
only_lonely
Topic Starter
Intermediate



Posts: 215




« on: July 24, 2010, 05:38:06 AM »

i want to copy 8 huge folders to external hardisk, but i want to do this one folder each time at schedule time, because those files may access by others during office hour.

so when i run it, it will only copy specific folder to ext hdd at schedule time (e.g 7/24/2010 12.00a.m)...and a log file will be generated when finished copy (e.g abc folder 1234 files copied at 7/24/2010 12.30a.m)...
IP logged
only_lonely
Topic Starter
Intermediate



Posts: 215




« Reply #1 on: July 25, 2010, 01:18:15 AM »

i got this code to create data folder but somehow it doesn't work perfectly

Code: [Select]
@echo off
SET date="%date:~6,4%-%date:~0,2%-%date:~2,2%"

md D:\2\%date%
xcopy /e C:\1\*.* D:\2\%date%
@pause

the folder create is D:\2\2010-07-\2

my system date format is
07/25/2010 Sun 15:22:52.92
IP logged
marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #2 on: July 25, 2010, 09:36:19 AM »

xcopy /e C:\1\*.* D:\2\%date%

Prompt user for folder name

or
 use a command line argument

xcopy /e C:\%1\*.* D:\2\%date%
IP logged

USA
marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #3 on: July 25, 2010, 04:12:41 PM »

Rem  date is a command and should be used a variable name

Code: [Select]
@echo off
set MM=%date:~4,2%
set DD=%date:~7,2%
set YYYY=%date:~10,4%
echo MM=%MM%
echo DD=%DD%
echo YYYY=%YYYY%
set mydate=%MM%-%DD%-%YYYY%
echo mydate=%mydate%
pause
e:
cd 2

md %mydate%
copy C:\1\*.*  e:\2\%mydate%\

cd  e:\2\%mydate%\
dir

lon.bat
MM=07
DD=25
YYYY=2010
mydate=07-25-2010
Press any key to continue . . .

C:\1\world1.txt
C:\1\world2.txt
C:\1\world3.txt
        3 file(s) copied.
 Volume in drive E is My Book
 Volume Serial Number is 0850-D7C5

 Directory of e:\2\07-25-2010

07/25/2010  05:10 PM    <DIR>          .
07/25/2010  05:10 PM    <DIR>          ..
07/25/2010  05:10 PM    <DIR>          07-25-2010
07/25/2010  05:01 PM                16 world1.txt
07/25/2010  05:01 PM                16 world2.txt
07/25/2010  05:01 PM                16 world3.txt
             
e:\2\07-25-2010>
IP logged

USA
marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #4 on: July 25, 2010, 08:14:36 PM »

Rem  date is a command and should be used a variable name

date is a command and should not be used as a variable name.
IP logged

USA
Salmon Trout
Prodigy



Thanked: 503
Posts: 7,396

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #5 on: July 26, 2010, 08:04:30 AM »

Rem  date is a command and should be used a variable name

date is a command and should not be used as a variable name.

%date% is already used as a system variable name, Bill, so it should not be modified or altered.
IP logged

marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #6 on: July 26, 2010, 09:13:25 AM »

date is a command and should not be used as a variable name.
i got this code to create data folder but somehow it doesn't work perfectly

Code: [Select]
@echo off
SET date="%date:~6,4%-%date:~0,2%-%date:~2,2%"

md D:\2\%date%
xcopy /e C:\1\*.* D:\2\%date%
@pause

the folder create is D:\2\2010-07-\2

my system date format is
07/25/2010 Sun 15:22:52.92

date is a command and should not be used as a variable name.C:\>date /t
Mon 07/26/2010

C:\>echo %DATE%
Mon 07/26/2010

C:\>date
The current date is: Mon 07/26/2010
Enter the new date: (mm-dd-yy)

C:\>
IP logged

USA
Helpmeh
Egghead



Thanked: 116
Posts: 3,584

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #7 on: July 26, 2010, 09:14:38 AM »


C:\>date /t
Mon 07/26/2010

C:\>echo %DATE%
Mon 07/26/2010

C:\>date
The current date is: Mon 07/26/2010
Enter the new date: (mm-dd-yy)

C:\>
Yes, and your point is, Bill?
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #8 on: July 26, 2010, 09:24:40 AM »

The original poster( only_lonely )  used the command "date" as a personal variable:

@echo off
SET date="%date:~6,4%-%date:~0,2%-%date:~2,2%"
IP logged

USA
Helpmeh
Egghead



Thanked: 116
Posts: 3,584

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #9 on: July 26, 2010, 09:50:44 AM »

Good job editing your post bill!
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Salmon Trout
Prodigy



Thanked: 503
Posts: 7,396

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #10 on: July 26, 2010, 09:51:13 AM »

The original poster( only_lonely )  used the command "date" as a personal variable:

@echo off
SET date="%date:~6,4%-%date:~0,2%-%date:~2,2%"


Bill, this may or may not be a bad idea, as thereafter in that session, (and only in that session) the system variable %date%, which is provided for the user's convenience, will be different from the default (as set in Regional Options in Control Panel). As I say, it may or may not be a bad thing. The sky won't fall, however, Bill.
IP logged

Salmon Trout
Prodigy



Thanked: 503
Posts: 7,396

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #11 on: July 26, 2010, 11:10:15 AM »

Like I said, only in that session...

IP logged

marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #12 on: July 26, 2010, 11:53:13 AM »


The following (reply 1 above ) is from the original poster, only_lonely.  The name given to the file was not  the goal.  Using a command, "date" as a personal variable  does not work
.

type ol726.bat
@echo off
SET date="%date:~6,4%-%date:~0,2%-%date:~2,2%"
echo  date=%date%
pause

md e:\2\%date%
copy  C:\1\*.* e:\2\%date%

dir
ol726.bat
date="Mo-n-"/-26"
the above is mistake

Terminate batch job (Y/N)? y

p.s. It does not work for this session or any session
IP logged

USA
Salmon Trout
Prodigy



Thanked: 503
Posts: 7,396

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #13 on: July 26, 2010, 12:37:35 PM »

Bill posts his usual nonsense. Countdown to ban time...
IP logged

marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #14 on: July 26, 2010, 01:54:07 PM »

???
IP logged

USA
Pages: [1] 2  All - (Top) Print 
Home / Microsoft / Microsoft DOS / shedule time for copy/transfer folders job « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.114 seconds with 22 queries.