I want to create a batch file (.bat) that changes [file name

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Pongy
Posts: 2
Joined: 25 Jul 2010 03:23

I want to create a batch file (.bat) that changes [file name

#1 Post by Pongy » 25 Jul 2010 03:35

Dear Master Batch Programmers,

Here's the dealio: many software applications come without an auto-save function. I'm flabbergasted. Flabbergasted I say. Excel, Propellerhead Reason, simple apps like Wavosaur... No auto-save! I don't get it. Been thinking about it and I still don't get it. It seems like such a basic function that should be standard in all apps, especially very popular ones such as Excel. Well Excel's got auto-save but it doesn't work the way I want it. And Reason and Wavosaur don't have auto-save at all. Music creativity tools without auto-save... I rest my case. I love both of them but god bless their souls I'm clueless as to this issue.

Alright, 'nuf said about that. Let's create a tool for this. C'mon we can do it.

I've figured out the following solution. Let's create a batch file (.bat) that changes [file name] in a given folder to [date]+[file name], waits 10 seconds and then loops. In that way, every time a file is saved to the folder it will be renamed and thus make place for a new file.

I hope you're following. Let's clarify and summarize:

The batch script is running until turned off by the user. When a file is added to a specific folder the script renames the file name from e.g. save.rsn to 1007181053save.rsn [YYMMDDMMSS]. The script waits for 10 seconds then checks the folder again and renames any hitherto unrenamed files.

Help me out here oh master programmers!

Kind regards

Pongy

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: I want to create a batch file (.bat) that changes [file

#2 Post by aGerman » 25 Jul 2010 12:54

Funny things.
Did you ever try to make that by hand? E.g. an Excel file is protected if it is opened. You can't rename it or something else. And if you didn't save your documents then a copy of this document will not contain your changes!
No idea what this could be good for ....

Regards
aGerman

Pongy
Posts: 2
Joined: 25 Jul 2010 03:23

Re: I want to create a batch file (.bat) that changes [file

#3 Post by Pongy » 25 Jul 2010 13:05

I have no idea what your comment is good for either, please refrain from commenting on my posts again.

phillid
Posts: 109
Joined: 03 Apr 2010 20:27
Location: Wellington, New Zealand
Contact:

Re: I want to create a batch file (.bat) that changes [file

#4 Post by phillid » 25 Jul 2010 22:34

No need to be so harsh on aGerman. :cry:
I think I get the drift of what you are attempting to do. You could make a copy of the document, name it [date][filename] and overwrite it every N minutes with an updated copy. But as aGerman said, you would have to save the document every so often for the copy to be up-to-date. I have tried putting the date and time into a filename, but they both contain illegal characters. The date has / and the time has : It would only require a simple FOR loop to filter these characters out.

phillid

miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Re: I want to create a batch file (.bat) that changes [file

#5 Post by miskox » 26 Jul 2010 04:26

I agree with phillid.

aGerman was not doing anything wrong. He just warns against the 'file locked' conflict.

Saso

Post Reply