View Full Version : Automation of renaming files


hade
25-01-2006, 12:56
Yello

Is there a way to automatically rename files dropped into a particular folder?

Like:
I've files that have no extention being generated by one application and dropped into a folder. These files are intended to be picked up by another application, but that app will only read txt files.

So I need the files to automatically have the extention .txt to be added as soon as they are dropped into the folder...

It's on Win2k3 server.

Is there any way to do this???
x

steev
25-01-2006, 13:00
I'm pretty sure you can do it from a dos prompt...

move * *.txt

or to be on the safe side...

copy * *.txt

**edit - sorry, to do this automatically you can put the relevant (copy or move) command line in an otherwise empty text file, save it as rename.bat (or something_else.bat) & set task scheduler to run it how ever often you like.

sccsux
25-01-2006, 13:14
Is there any way to do this???
x

When you save the file, can you not simply give it a txt extension ie.

"nameoffile.txt" - keeping the quotes?

hade
25-01-2006, 13:32
I'm not actually saving anything. I've an application running that downloads text files from a website, but they have no extention. There aren't any settings to change this in the app.

I suppose what I'm looking for is some sort of special Folder behaviour that will add the extention as the files arrive, without any intervention from me, as it's a newswire and the files are pretty much live and arrive constantly throughout the day.

sccsux
25-01-2006, 13:40
I'm not actually saving anything. I've an application running that downloads text files from a website, but they have no extention. There aren't any settings to change this in the app.

I suppose what I'm looking for is some sort of special Folder behaviour that will add the extention as the files arrive, without any intervention from me, as it's a newswire and the files are pretty much live and arrive constantly throughout the day.


Ah. I see now;). I thought it was a Windows application you were using.

I don't think what you're requiring/wanting to do, is possible under any version of Windows I'm afraid (though I am quite ready to be corrected on this).

sccsux
25-01-2006, 13:42
I don't think what you're requiring/wanting to do, is possible under any version of Windows I'm afraid (though I am quite ready to be corrected on this).


Actually, that's c$!p.

Write a simple batch file similar to what steev above suggests, and set a schedule up to run it every 10 mins or so?

Simple Sample:


ren c:\path\to\folder\containing\files\*.*<SPACE>*.txt
exit


Save as whatever.bat and schedule it to be run whenever...


Ooops....


Just realised....

I've said virtually the same as steev....

steev
25-01-2006, 13:49
If you use that example it won't work unless the file has some kind of file extension. Using *.* implies that there's a . in the filename.

I've said virtually the same as steev....

Well, great minds think alike. We obviously do to.

hade
25-01-2006, 13:59
Actually, that's c$!p.

Write a simple batch file similar to what steev above suggests, and set a schedule up to run it every 10 mins or so?

You star!
What about the fact that the files have no extention? -

Normally -
rename *.extention *.newExtention

would it be
rename *[space]*.txt ??

Cyclone
25-01-2006, 14:16
yes it would

hade
25-01-2006, 14:36
The renaming part now works fine, but I'm haing trouble with scheduling the task. Am I right using the scheduled task wizard? With this I can only choose to run it at most once a day.

Cyclone
25-01-2006, 14:46
set it for once per day, then go into the advanced properties, (it asks you if it should open it when you compelte the wizard), select the schedule tab, selected advanced, then select repeat this task every x minutes.

sccsux
25-01-2006, 15:44
If you use that example it won't work unless the file has some kind of file extension. Using *.* implies that there's a . in the filename.

Not true, under Win 98 when using DOS the asterisk must be followed by a dot followed by the files extension (whether it has one or not) Dos used to not like spaces, which is why I included the second asterisk.

What I'm meaning is...... under Win 98 all files have an extension (whether is is a space or whatever) and (in my reply - which relates to Win 98 as that is the only MS GUI OS I have any great experience of) the first asterisk means everything upto the . with any extension (this way, Win 98s DOS can cope with empty file extensions)


I assumed later vers of Windows would be the same?

steev
25-01-2006, 15:51
Sorry, my bad, just tried & both ways work in XP & 2003.

Blame Linux, it's all I've done command prompt sty-lee for the last 1 1/2 years, & your way doesn't work in Linux AFAIK :P

**edit - wow, I've just blamed linux for something, that's a first...

Cyclone
25-01-2006, 16:37
Not true, under Win 98 when using DOS the asterisk must be followed by a dot followed by the files extension (whether it has one or not) Dos used to not like spaces, which is why I included the second asterisk.

What I'm meaning is...... under Win 98 all files have an extension (whether is is a space or whatever) and (in my reply - which relates to Win 98 as that is the only MS GUI OS I have any great experience of) the first asterisk means everything upto the . with any extension (this way, Win 98s DOS can cope with empty file extensions)


I assumed later vers of Windows would be the same?

windows 98 will allow files with no file name extension. Indeed I think you could create them back in Dos 3.1, which is as far back as I go.
The . however is treat as a special character i believe, certainly in the 8.3 days you couldn't have more than 1 dot in the filename.

sccsux
25-01-2006, 16:40
your way doesn't work in Linux AFAIK :P

I know, but this is a Windows problem:P.

Any nix system would have been easy:)

sccsux
25-01-2006, 16:41
windows 98 will allow files with no file name extension. Indeed I think you could create them back in Dos 3.1, which is as far back as I go.
The . however is treat as a special character i believe, certainly in the 8.3 days you couldn't have more than 1 dot in the filename.

Yeah, but there was still an extension (though it was a control code);)

steev
25-01-2006, 18:13
Aw shucks, agreeing about Linux & now reminis... remin... remi... getting all nostalgic about 'doze 98, I love this place... :rolleyes: :hihi:

Shhh, that's at least 5 posts off topic & no-one's noticed yet... :suspect: