hiteksoftware.com Forum Index hiteksoftware.com
User discussion forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Filename - Replace multiple "." with "_"

 
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Frequently Asked Questions
View previous topic :: View next topic  
Author Message
zickb



Joined: 10 Apr 2007
Posts: 13

PostPosted: Fri Sep 18, 2009 10:37 am    Post subject: Filename - Replace multiple "." with "_" Reply with quote

Have a directory with numerous files. Each file has several "." in the filename. The number of characters between each "." varies between files.

I need to replace all instances of "." with "_"
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Fri Sep 18, 2009 12:39 pm    Post subject: Reply with quote

try a copy task (rename mode)

filename field:
REGEXF=\.

rename field:
_
Back to top
View user's profile Send private message
zickb



Joined: 10 Apr 2007
Posts: 13

PostPosted: Tue Dec 15, 2009 9:52 am    Post subject: Replace characters and move to dynamically created directory Reply with quote

Have different files all that need to have "." replaced with "_". Also need to selectively move files to a dynamically created directory named from the filename characters up to the first ".", Example

File1 - abcdef.hijklmn.opqrstuvw.xyz.txt
File2 - abcd.efhijklmn.opqrstuv.wx.yz.txt
File3 - abcdef.hijkl.mnopqrstuv.wxyz.txt
File4 - abcd.efhijkl.mnopqrstuvw.xyz.txt
File5 - ab.cdefhijkl.mnopqrstu.vwxyz.txt

Files 1 & 3 go into a dynamically created folder named "abcdef"
Files 2 & 4 go into a dynamically created folder named "abcd"
File 5 goes into a dynamically created folder named "ab"
Back to top
View user's profile Send private message
melvin
Site Admin


Joined: 25 May 2006
Posts: 635
Location: Santa Barbara, california

PostPosted: Wed Dec 16, 2009 8:43 pm    Post subject: Reply with quote

You would have to use a directory loop task + extract variable task + copy task.

dirloop settings:
task title = dirloop
task to run = extract|copy

extract variable value settings:
task title = extract
variable name = dirloop::CurrentFilename
Regex = ([a-zA-Z]{1,})

copy task settings:
task title = copy
target directory= c:\test\$%extract::Value1%$
filename = $%dirloop::CurrentFilename%$
Back to top
View user's profile Send private message Send e-mail
csteenbock



Joined: 14 Oct 2009
Posts: 9

PostPosted: Thu Jul 01, 2010 6:28 am    Post subject: Reply with quote

This is great! Used it to replace spaces instead of periods.

Robert wrote:
try a copy task (rename mode)

filename field:
REGEXF=\.

rename field:
_
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Frequently Asked Questions All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group