0

I am remming some files. First I create a list.

files_list<-list.files() 

Now I edit the list of files so I can manually arrange them in any order I want.

new_files_list<-edit(files_list) 

Using the file.rename function I am able to rename the files numerically. How can I modify the command below so it uses the file order I manually set in the above command?

file.rename(from = list.files(pattern="file*"), paste0(stem_file_name,numeric_renaming, ".abc")) 

1 Answer 1

1

this will rename all files in the folder by numerate them. Be carfull with this, you can produce a lot of disorder in your system when you don't change the working directory with setwd().

setwd("/home/spazieren/playground") files_list<-list.files() new_files_list <- edit(files_list) file.rename(from = files_list, to=new_files_list) 
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your answer, but my main question is to edit the list of files manually in new_files_list<-edit(files_list), then somehow use that new list in the file.rename function
Maybe I don't understand your point. But you can use it last with your line

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.