Questions tagged [rename]

For anything regarding renaming. Could be applicable to a wide range of subjects. Should be replaced by a more domain-specific tag if applicable.

Questions regarding renaming one or many files, directories, projects, variables, users, data cells, and version control conflicts arising from renaming should be tagged with rename.

To rename a file means to give an existing file a new name without changing any of its content. In UNIX systems, this is done with the mv command.

Renaming a variable will usually require a find-and-replace edit in existing code.

5438 questions
1
vote
3 answers

Rename columns with ranges based on dictionary

I have this dataframe: df = pd.DataFrame( {'an2': {0: 'f', 1: 'i', 2: '', 3: '', 4: 'f', 5: 'c,f,i,g', 6: 'c,d,e,g'}} ) which yields to: an2 0 f 1 i 2 3 4 f 5 c,f,i,g 6 c,d,e,g I would like to create new column df['an3'] by…
josepmaria
  • 373
  • 1
  • 11
1
vote
1 answer

How to copy a file two folders back by replacing file name with names of folders using python

I have several folders such as a1-b1, a1-b2, a1-b3. a2-b2 and so on. Within each folder there are subfolders e.g. c_1, c_2, c_3 and so on. Within each subfolder I have data files with same name e.g. abc.dat. I desire to copy abc.dat two folders back…
ali
  • 61
  • 2
  • 9
1
vote
2 answers

How to apply a rename command to all subfolders in powershell?

I am new to powershell and I am having a hard time applying this one command to all of the subfolders I have. I have used: ls | Rename-Item -NewName {$_.name -replace "ALL",""} And this works for only the one subfolder that I am in. This takes the…
Cole
  • 15
  • 3
1
vote
1 answer

How to append date to batch file on Windows XP

Suppose I have the files as below C |_tmp |_a.txt |_b.txt |_c.txt I use rename *.txt 20110822*.txt, but not works. Could anyone please suggest a method to append date in front of the files, thanks
Charles Yeung
  • 38,347
  • 30
  • 90
  • 130
1
vote
2 answers

How to rename column header that is a numerical value instead of a string in python/pandas?

I have a column that's named '207', and I want to replace it with a string, say "thing". I've tried to follow nearly every method mentioned here (Rename specific column(s) in pandas) but I can't seem to get it to work? My assumption is that it's…
Applesauce44
  • 123
  • 4
1
vote
1 answer

How to add spaces while renaming files in batch

So recently, I have tried to make myself a batch script to rename files by replacing a certain string by another. It is sucessful, until you add spaces. This is what my code currently looks like : @echo off :0 cls set /p "str=String to replace :…
Infers
  • 17
  • 4
1
vote
2 answers

Bash script to copy numbered files in reverse order

I have a sequence of files: image001.jpg image002.jpg image003.jpg Can you help me with a bash script that copies the images in reverse order so that the final result is: image001.jpg image002.jpg image003.jpg image004.jpg <-- copy of…
Alan Turing
  • 12,223
  • 16
  • 74
  • 116
1
vote
1 answer

Rename and download links - CSV file

I have a CSV file with 6 columns and many rows. I would like to download all the png or jpg from the column 'link' in a folder with the same name of my CSV file.Then I would like to rename these images with each 'title' content. url1.png by…
bigbox
  • 17
  • 5
1
vote
1 answer

How to change character into numeric of a dataframe within a list in R?

I would like to convert a character vector within a dataframe of a list into a numeric one. I have an example attached. Data at the end looks like my list I import directly into R and in which I want to convert character into…
timtams
  • 101
  • 6
1
vote
2 answers

Unnamed columns - rename - pandas

I am trying to rename unnamed columns in my data frame. Value of the 1st row in this column is expected to become a name of that column. If a column doesn't contain Unnamed, its name should remain unchanged. I try to achieve it this way: for col…
anla01
  • 113
  • 10
1
vote
0 answers

Trying to change all image file names in a folder to the date and time image was taken

I have a folder of images that I am trying to change to be the date and time the picture was taken. I managed to make it work for the most part, however if the image has the same DateTimeOriginal (to the second), the subsequent images are deleted…
1
vote
1 answer

Rename files as the ID from the directory name, many nested files

I would like to rename by files that end with .txt which are nested deeply within a set of files, based on the name of the directory but taking ONLY that before the "_" as it is the ID and thus creating "ID_TreatedSubject.txt" file This is what I…
Francesca C
  • 177
  • 1
  • 9
1
vote
1 answer

Rename all files in a directory to be the same as the directory

I have a folder called "tokens". In this folder, I have several other folders, called things like "guard", "noble", "assassin", etc. In those folders are image files with varying names and file formats. I would like to run through the all the…
Regniwekim
  • 11
  • 3
1
vote
2 answers

How to rename files(and move them) in PowerShell 5.1?

I am new to PowerShell and I am stuck at something really simple. I have Googled a lot and got this far but can't seem to resolve this. I am trying to do a simple file transfer from one server to the other. The purpose of the script is to check if…
Brute
  • 121
  • 1
  • 10
1
vote
2 answers

How can I rename all specified file extensions within a folder while preserving the file timestamps?

I'm trying to rename the file extensions of a collection .txt files while also preserving the timestamps. I first attempted to use Robocopy, but this tool can only copy files from one directory to another while preserving file timestamps (file…
Sidley
  • 43
  • 3