rename

rename multiple files in a folder using R [duplicate]

为君一笑 提交于 2019-12-30 11:54:27
问题 This question already has answers here : How do I rename files using R? (2 answers) Closed 5 years ago . I have a folder which contains several files named by the date the data was measured. For example: "07182014.csv","07192014.csv"... Since I have multiple stations for the measurements, I would like to add the station number before each file name for distinguish purposes. For example, the file "07182014.csv" will become "N1_07182014.csv". I'm new to R, and most of the time I search the web

Rename image file name in matlab

我与影子孤独终老i 提交于 2019-12-30 10:46:22
问题 I Load 10,000 image files from internet site and i save it in the folder to use it in my project (image retrieval system ), now i need to rename image file in a sequential name like (image1,image2,image3,....image10000) , any one can help me... I would like to inform you that I used matlab in my work thank 回答1: One thing you'll want to keep in mind is exactly how the format of the number part of the file name will look, as this can sometimes affect the ordering of the files in the directory.

Remove Last Characters from my filenames in windows

☆樱花仙子☆ 提交于 2019-12-30 10:33:48
问题 Im quite new to batch programming and i wanted to remove the last characters on my filename. 10_myfile_12345_6789.txt 11_myfile_12345_0987.txt I want to remove the last 4 digits on my filename how i could do that? I have tried this @echo off setlocal enabledelayedexpansion set X=3 set FOLDER_PATH= pushd %FOLDER_PATH% for %%f in (*) do if %%f neq %~nx0 ( set "filename=%%~nf" ren "%%f" "!filename!%%~xf" ) popd PAUSE but it removes on first and last characters, i only saw this here too, im still

Remove Last Characters from my filenames in windows

久未见 提交于 2019-12-30 10:32:50
问题 Im quite new to batch programming and i wanted to remove the last characters on my filename. 10_myfile_12345_6789.txt 11_myfile_12345_0987.txt I want to remove the last 4 digits on my filename how i could do that? I have tried this @echo off setlocal enabledelayedexpansion set X=3 set FOLDER_PATH= pushd %FOLDER_PATH% for %%f in (*) do if %%f neq %~nx0 ( set "filename=%%~nf" ren "%%f" "!filename!%%~xf" ) popd PAUSE but it removes on first and last characters, i only saw this here too, im still

Sparklyr - Change columns names in a Spark dataframe

前提是你 提交于 2019-12-29 08:06:07
问题 df <- data.frame(old1 = LETTERS, old2 = 1) df_tbl <- copy_to(sc,df,"df") df_tbl <- df_tbl %>% dplyr::rename(old1 = new1, old2 = new2) returns: > head(df_tbl) Error: `new1`, `new2` contains unknown variables Is there an easy way to change the column names using Sparklyr? 回答1: First of all you mixed the order: df_tbl %>% rename(new1 = old1, new2 = old2) but with Sparklyr you have to use select : df_tbl %>% select(new1 = old1, new2 = old2) 来源: https://stackoverflow.com/questions/45514906

Rename files in multiple directories to the name of the directory

久未见 提交于 2019-12-29 04:17:05
问题 I have something like this: v_1/file.txt v_2/file.txt v_3/file.txt ... and I want to rename those files to something like this: v_1.txt v_2.txt v_3.txt ... in the same directory. I guess I can use rename but I can't figure out how to use it with folder and file renaming at the same time. 回答1: The result can be achieved with a bash for loop and mv : for subdir in *; do mv $subdir/file.txt $subdir.txt; done; Note that the solution above will not work if the directory name contains spaces.

Linux: remove file extensions for multiple files

自古美人都是妖i 提交于 2019-12-28 08:09:10
问题 I have many files with .txt extension. How to remove .txt extension for multiple files in linux? I found that rename .old .new *.old substitutes .old extension to the .new Also I want to do this for files in sub-folders. 回答1: rename is slightly dangerous, since according to its manual page: rename will rename the specified files by replacing the first occurrence of... It will happily do the wrong thing with filenames like c.txt.parser.y . Here's a solution using find and bash : find -type f

git diff renamed file

喜夏-厌秋 提交于 2019-12-28 08:06:48
问题 I have a file a.txt . cat a.txt > hello The contents of a.txt is "hello". I make a commit. git add a.txt git commit -m "first commit" I then move a.txt into a test dir. mkdir test mv a.txt test I then make my second commit. git add -A git commit -m "second commit" Finally, I edit a.txt to say "goodbye" instead. cat a.txt > goodbye I make my last commit. git add a.txt git commit -m "final commit" Now here is my question: How do I diff the contents of a.txt between my last commit and my first

substitute file names using rename

蓝咒 提交于 2019-12-26 12:10:31
问题 I want to rename files names by substituting all the characters starting from "_ " followed by eight capital letter and keep only the extension. 4585_10_148_H2A119Ub_GTCTGTCA_S51_mcdf_mdup_ngsFlt.fm 4585_10_148_H3K27me3_TCTTCACA_S51_mcdf_mdup_ngsFlt.fm 4585_27_128_Bap1_Bethyl_ACAGATTC_S61_mcdf_mdup_ngsFlt.fw 4585_32_148_1_INPUT_previous_AGAGTCAA_S72_mcdf_mdup_ngsFlt.bw expected output 4585_10_148_H2A119Ub.fm 4585_10_148_H3K27me3.fm 4585_27_128_Bap1_Bethyl.fm 4585_32_148_1_INPUT_previous.fm

How to rename and move files to new directory

℡╲_俬逩灬. 提交于 2019-12-25 14:12:31
问题 I would like to rename files that are uploaded to another server from extension .txt to .txt_mvd and move to a different directory for archiving in a Windows batch mode. Can anyone help with what the windows batch script should be? Thanks. 回答1: Here is the code FOR /R C:\your_folder %%d IN (*.txt) DO ( ren %%d %%~nd.txt_mvd ) %%d is the full file name + path %%~nd return only the file name without the extension Using the /R parameter, it will scan folder and subfolder UPDATE 1 The following