Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ren- turns file into a folder
#2
You have two problems with the code your using . When using wildcard characters in filename part of from. Then to must be folder. All matching files will be copied to the folder.
also you have invalid filename characters in your date string 
these are not allowed in filenames in windows
  • < (less than)
  • > (greater than)
  • : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • * (asterisk)
 
need to first enumerate to find the file then remove invalid filename characters then can rename
Code:
Copy      Help
Dir d
foreach(d "$desktop$\last backup*.txt" FE_Dir)
,str path=d.FullPath
,if(path.len)
,,str s.timeformat("{D} {hhmmss}")
,,s.ReplaceInvalidFilenameCharacters("-")
,,str n.from("$desktop$\last backup" s ".txt")
,,ren- path n


Messages In This Thread
ren- turns file into a folder - by Davidovsky - 03-11-2021, 05:19 AM
RE: ren- turns file into a folder - by Kevin - 03-11-2021, 02:03 PM
RE: ren- turns file into a folder - by Davidovsky - 03-12-2021, 04:07 AM
RE: ren- turns file into a folder - by Kevin - 03-12-2021, 04:43 AM
RE: ren- turns file into a folder - by Davidovsky - 03-12-2021, 09:55 AM
RE: ren- turns file into a folder - by Kevin - 03-12-2021, 01:43 PM
RE: ren- turns file into a folder - by Davidovsky - 03-13-2021, 04:33 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)