Batch programming, copying

Microsoft Windows 7 home premium
February 19, 2010 at 07:28:11
Specs: Windows XP, I dont know
I have a problem with batch programming.
I have a folder with alot of profile files for users. Each file have a unique name. Every night i want a script that
1) Copy file A
2) The copy of file A should get the name of file B
3) The original file B should be deleted.
4) Continue doing this until all the files in the folder is a copy of A.

I have no idea where to start.

Thanks in advance

See More: Batch programming, copying

Report •

February 19, 2010 at 12:00:12
Sounds like you want to move all files for folder 1 to folder 2 ?

Report •

February 19, 2010 at 19:24:28
yes, please make up a specific example of the exact operation you want to do, (two or three diff. files to set a good pattern).
it looks like all you're doing is renaming the files...

Report •

February 20, 2010 at 06:06:10

move /-Y C:\example\directory\*.* C:\another\directory

Report •

Related Solutions

February 22, 2010 at 05:21:34
I will try to explain a bit better
In Folder C:\profilefiles there are 30 files. These files are all
unique and have the users login as file name. Every night i
want to make 30 copies of the master profile file (also in the
same folder) and rename these files with the other users
profile file names.
So the steps are:
Get the names of the files in the folder
Delete all files except profile file
Copy user profile file and rename with name of files that where
just deleted from folder.

Then i know windows scheduler can be set to run this every

I hope anyone can help :)
Thanks in advance

Report •

February 22, 2010 at 07:45:12
yes, that clarifies things somewhat.
here's a thing to try:

pushd c:\profiles
attrib +r master.fil
for %%a in (*.*) do move /y master.fil %%a
:: attrib -r master.fil (prob'ly not needed)

you might want to backup the directory prior to trying -
script untested. here's a "sanitized" version:

for %%a in (*.*) do >> fix.bat echo move /y master %%a
more fix.bat
:: call fix.bat
:: del fix.bat

Report •

February 23, 2010 at 03:17:08
> Then i know windows scheduler can be set to run
> this every
> night.

What you can try is this : at the end of the script you want to schedule to be run, add a call like this :

D:\Temp>at 12:12 d:\temp\test.cmd
Added a new job with job ID = 1


It will schedule the running of a script with the mentioned name, at the next occurance of the time specified. It's not as stable as other schedulers, since the scheduling has a good chance of being broken (lost), but it's just an idea. MS has got another scheduler as well.

Report •

Ask Question