[WINDOWS] How do I create a basic script?

Come up with a useful post-processing script? Share it here!
Post Reply
tjadonis
Newbie
Newbie
Posts: 2
Joined: August 27th, 2012, 3:59 pm

[WINDOWS] How do I create a basic script?

Post by tjadonis »

I have been googling and reading for hours but I can't make this work..


I want to have a script which moves everything from my complete folder to my movies folder as soon as the files have processed

i made a batch file like this:

@echo on
cd C:\Documents and Settings\Administrator\My Documents\Downloads\complete
move *.* d:\movies\
pause

but it doesnt work, I have tried a lot of different combinations of this, but I always get 'syntax error' or such like
I've tried it with the directory string in inverted commas and allsorts

Please can someone highlight the very obvious mistake I must be making here?!?!
Thanks
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: [WINDOWS] How do I create a basic script?

Post by sander »

"cd C:\Documents and Setting.." won't work. Try it out on the command line and you will see it ...

Solution:

C:
cd \Documents and Setting...


As a rule of thumb: first try commands on the command line to see if it works. Then put it in a .BAT file, and run that from the command line. And only then run it from SAB.

Furthermore:

move *.* d:\movies\

... does that work? WIll it move subdirectories? I have no Windows so I can't check for you.

PS: moving to another directory can be done by SAB based on (default) category. Maybe easier.
tjadonis
Newbie
Newbie
Posts: 2
Joined: August 27th, 2012, 3:59 pm

Re: [WINDOWS] How do I create a basic script?

Post by tjadonis »

thanks for the reply

move *.* d:\movies\ - no, this doesnt work. none of it does.

i keep trying it on the command line, but i cant get it to run - i am stuck
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: [WINDOWS] How do I create a basic script?

Post by sander »

Probably easier to create a Category and assign a destination directory to it ...
GasMan320
Newbie
Newbie
Posts: 2
Joined: September 1st, 2012, 3:25 pm

Re: [WINDOWS] How do I create a basic script?

Post by GasMan320 »

Try this:

@echo on
C:
cd \Documents and Settings\Administrator\My Documents\Downloads\complete
XCOPY * /E /Y /C D:\movies\
DEL /S /Q *
RMDIR /S /Q .

See if that works. Should copy all the contents and then delete the files and subdirectories in your complete folder.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: [WINDOWS] How do I create a basic script?

Post by shypike »

Shouldn't that be?
xcopy /e /s /y
GasMan320
Newbie
Newbie
Posts: 2
Joined: September 1st, 2012, 3:25 pm

Re: [WINDOWS] How do I create a basic script?

Post by GasMan320 »

Hey shypike,

Correct me if I'm wrong but I think /E by itself is equivalent to using /E /S together.
clinton hall
Newbie
Newbie
Posts: 22
Joined: August 4th, 2012, 8:35 pm

Re: [WINDOWS] How do I create a basic script?

Post by clinton hall »

To be safe I would use

@echo on
c:
cd "\Documents and Settings\Administrator\My Documents\Downloads\complete"
XCOPY * /E /Y /C D:\movies\
DEL /S /Q *
RMDIR /S /Q .

Using "" prevents issues with the spaces in the directory name. I see the first post indicates this was tried, so presumably the move was where the problem occurred, but I would leave the directory string in quotes and try the xcopy commands.
Post Reply