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 1957 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
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

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


Proud to be European
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: 117
Posts: 3,608

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: 117
Posts: 3,608

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
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

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


Proud to be European
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

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

Like I said, only in that session...

IP logged


Proud to be European
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
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

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

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


Proud to be European
marylane
Rookie



Thanked: 1
Posts: 26

USA

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

???
IP logged

USA
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #15 on: July 26, 2010, 02:24:46 PM »

???

We know you are Billrich. All the questionmark smileys in the world won't change that.
IP logged


Proud to be European
marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #16 on: July 26, 2010, 02:34:43 PM »

 ???
IP logged

USA
Helpmeh
Egghead



Thanked: 117
Posts: 3,608

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #17 on: July 26, 2010, 05:00:20 PM »

???
???
We know you are Billrich. All the questionmark smileys in the world won't change that.


Bill, you are such an obvious troll, but what still makes me stay awake at night is why you keep coming back. You are like the stupid cat which came back the next day.
Quote from: Comment on Video - NuggetVu
I remember this from my childhood. That cat is kind of a *censored*
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 #18 on: July 27, 2010, 06:07:47 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 created is D:\2\2010-07-\2

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


I'm sorry the thread got off topic.
IP logged

USA
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #19 on: July 27, 2010, 10:36:39 AM »

I'm sorry the thread got off topic.


So *censored* out, banned troll.
IP logged


Proud to be European
marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #20 on: July 27, 2010, 11:39:17 AM »

Only_lonely,

You have come to right board  for help.

The regular members are kind and professional.

The regular members never insult those asking for help.

You problem will be solved shortly if the problem is not already solved:

Do not use batch commands as a personal variable.

Good Luck and have a great day.
IP logged

USA
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #21 on: July 27, 2010, 12:39:45 PM »

The regular members never insult those asking for help.

But they are perfectly happy with baiting a banned troll.

IP logged


Proud to be European
marylane
Rookie



Thanked: 1
Posts: 26

USA

« Reply #22 on: July 27, 2010, 01:23:57 PM »

Only_lonely,

Good Luck and have a great day.

Please post the code that worked for you.
IP logged

USA
only_lonely
Topic Starter
Intermediate



Posts: 215




« Reply #23 on: July 29, 2010, 06:22:10 PM »

i got a working code after googling...i use backup command.
but unfortunately, it cannot copy huge files over network, "insufficient memory" displayed halfway copying....
anyone know why?
my working code...
Code: [Select]
@echo off
:: variables
set drive=D:\2
SET date="%date:~6,4%-%date:~0,2%-%date:~3,2%"

set backupcmd=xcopy /s /c /d /e /h /i /r /k /y

echo ### Backing up your Sites directory...
%backupcmd% "C:\1"  "%drive%\%date%"

echo Backup Complete - Your Backup is located at %drive%
@pause
IP logged
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.148 seconds with 20 queries.