-
March 23rd, 2003, 01:22 AM
#16
Junior Member
Originally posted by craigmodius
I'd also like to give a shout out to Grief for warming up the thread.
I got your back
-
March 24th, 2003, 12:45 PM
#17
Registered User
DON'T PANIC
-
April 26th, 2007, 04:13 PM
#18
Tell me more
Originally Posted by craigmodius
I'm not a god I just play one at work.
I'd also like to give a shout out to Grief for warming up the thread. We were talking at work today about this very same issue of getting the variable to work in NT, and I told him how I posted here and it seems like I have the uncanny ability to kill a thread just by posting on it, so he's got my back
OK - I have a need to name the file with the date AND time. I hacked at doing a for /f ....('time /t') ... but it failed... Help!
I need the code you sent out on the date (awesome) and then do the same wi th 'time /t' and concantenate the two to add to the name.
Thanks in advance
-
April 27th, 2007, 12:38 PM
#19
Driver Terrier
Welcome to Windrivers jferrel
Can you confirm that you want to change the data and time as well as the file name... if so, is the date and time to be changed to the same date and time?
Never, ever approach a computer saying or even thinking "I will just do this quickly."
-
April 27th, 2007, 01:11 PM
#20
Originally Posted by NooNoo
Welcome to Windrivers jferrel
Can you confirm that you want to change the data and time as well as the file name... if so, is the date and time to be changed to the same date and time?
OK - I was testing his code (the code above with the 'for /F' command) , and was able to do this:
copy c:\filename.txt i:\filename_042607.txt
(with success)
What I want to do is append the 'time' of the copy as well, to the filename; this way I can make multiple copies of the original file in one day and they will remain unique.
I want endup with this:
copy c:\filename.txt i:\filename_042607_1:35PM.txt
(with success)
I duplicating the code and parsing ('time /t'), but found I am a loser and can't get it right.
HELP!!!!
-
April 27th, 2007, 03:16 PM
#21
Driver Terrier
Well you can't have a ":" in the filename....
Never, ever approach a computer saying or even thinking "I will just do this quickly."
-
April 27th, 2007, 03:23 PM
#22
Originally Posted by NooNoo
Well you can't have a ":" in the filename....
OK...I'll try using delims=: and parse out the time numbers and then concantenate... I'll let you know...
-
September 10th, 2007, 05:13 PM
#23
You all seem like really smart folks..... (notice the buttering up....). I'm struggling with a problem that a newer version of AutoCAD is throwing at me. We're jumping from Release 14 (around 1998) up to AutoCAD 2007. I Have a batch process to save plot files on our file server. This version of AutoCAD insists on appending -Layout1 to the filename. So whereas we currently have 4000+ plot files that look like this: tw184892.plt we are now forced to use plot files that look like this tw184892-Layout1.plt. The plot files are being called from a database, to print at the bottom of a sheet with barcode information on it. So, as part of my batch file save process, I'd like to save the plot file without the -Layout1 in the name. Is there a way to rename the plot file at the dos level (really WinXP, not DOS), taking into account that the current file name that needs to be renamed could be:
my-Layout1.plt
myfile-Layout1.plt
myfile0005-Layout1.plt
So I can't just strip off the first X number of characters. I could strip out the last 8 characters of the file name. Any thoughts? This is the first part of the process:
F:
CD \OPEN\DWG
DIR /B /L *.PLT | FIND ".plt" > PLT.BAK
COPY C:\ACAD2007\SUPPORT\DO.DAT+PLT.BAK DO.BAK > NUL
COPY C:\ACAD2007\SUPPORT\DOE.DAT+DO.BAK DO.BAT > NUL
CALL DO.BAT
By the end of this, I end up with DO.BAT which looks like this:
IF NOT %1! == ! SET DWG=%1
IF NOT %DWG%! == ! C:\VEDIT\VPW -X CLEANPLOT.VDM %DWG%
IF NOT %DWG%! == ! MOVE %DWG% F:\OPEN\PLT\
IF NOT %DWG%! == ! EXIT
DO tw4841eb-layout1.plt
So, I could easily put some kind of a RENAME function in there, but I'm not sure about how to go about doing the last 8 char? Any thoughts?
Mick
-
September 11th, 2007, 04:20 AM
#24
Driver Terrier
Welcome to Windrivers Mickth
Just thinking round the problem... what happens if you end up with a layout-2? Is it that the database column width cannot handle the new filename length? If so, just create a new table, with the appropriate widths, populate it from the old table, drop the old table, rename the new table and then never have to bother about it again.
I say this because you are introducing another processing step which could result in a point of failure and this processing has to take place at least daily whereas a simple change to the database takes 5 minutes once.
Never, ever approach a computer saying or even thinking "I will just do this quickly."
-
September 11th, 2007, 04:43 AM
#25
Driver Terrier
Oh, if you want to do the batch file thing anyway you need to remove the substring -layout1
set str=tw123456-layout1.plt
set str=%str:-layout1 =%
more info here
Never, ever approach a computer saying or even thinking "I will just do this quickly."
-
May 21st, 2010, 10:44 AM
#26
Needs Help
I am trying to ren a whole lot of files using for /r %i in (*.*) do ren "%i" "%i.tif"
and get a syntex error any help?
-
May 24th, 2010, 08:31 AM
#27
Registered User
Originally Posted by grantl
I am trying to ren a whole lot of files using for /r %i in (*.*) do ren "%i" "%i.tif"
and get a syntex error any help?
Are you using this syntax in a batch file? If yes you'll need to double the % sign... so:
for /r %%i in (*.*) do ren "%%i" "%%i.tif"
Protected by Glock. Don't mess with me!
-
May 24th, 2010, 10:41 AM
#28
I tried that, recieved a sytex error on the command.
-
May 24th, 2010, 10:56 AM
#29
Registered User
Try
for /r %i in (*.*) do ren "%i" "%~nxi.tif"
You may not specify the full path for the destination file while renaming, just the new name
%~nxi will expand the %i variable to name and extension (ex c:\temp\file1.txt -> file1.txt)
Edit: of course if placed in a batch file you have to use %%i instead of %i
Protected by Glock. Don't mess with me!
-
May 27th, 2010, 08:24 AM
#30
Originally Posted by mickth
You all seem like really smart folks..... (notice the buttering up....). I'm struggling with a problem that a newer version of AutoCAD is throwing at me. We're jumping from Release 14 (around 1998) up to AutoCAD 2007. I Have a batch process to save plot files on our file server. This version of AutoCAD insists on appending -Layout1 to the buy viagra uk filename. So whereas we currently have 4000+ plot files that look like this: tw184892.plt we are now forced to use plot files that look like this tw184892-Layout1.plt. The plot files are being called from a database, to print at the bottom of a sheet with viagra soft barcode information on it. So, as part of my batch file save process, I'd like to save the plot file without the -Layout1 in the name. Is there a way to rename the plot file at the dos level (really WinXP, not DOS), taking into account that the current file name that needs to be renamed could be:
my-Layout1.plt
myfile-Layout1.plt
myfile0005-Layout1.plt
So I can't just strip off the first X number of characters. I could strip out the last 8 characters of the file name. Any thoughts? This is the first part of the process:
F:
CD \OPEN\DWG
DIR /B /L *.PLT | FIND ".plt" > PLT.BAK
COPY C:\ACAD2007\SUPPORT\DO.DAT+PLT.BAK DO.BAK > NUL
COPY C:\ACAD2007\SUPPORT\DOE.DAT+DO.BAK DO.BAT > NUL
CALL DO.BAT
By the end of this, I end up with DO.BAT which looks like this:
IF NOT %1! == ! SET DWG=%1
IF NOT %DWG%! == ! C:\VEDIT\VPW -X CLEANPLOT.VDM %DWG%
IF NOT %DWG%! == ! MOVE %DWG% F:\OPEN\PLT\
IF NOT %DWG%! == ! EXIT
DO tw4841eb-layout1.plt
So, I could easily put some kind of a RENAME function in there, but I'm not sure about how to go about doing the last 8 char? Any thoughts?
Mick
Thanks. Now it works
Last edited by MarCn; June 1st, 2010 at 08:32 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks