file-rename

Batch rename issue when dealing with special characters in the filename

时间秒杀一切 提交于 2019-12-10 10:54:09
问题 I have several hundred *.mp3 files in c:\files. There are all imaginable filenames in there like milad.mp3 (good behaving) hey you.mp3 (space in filename) systemofadown.mp3 (long filename) howdy(1).mp3 (parentheses in filename) and any combination of the last three conditions. I want to rename the files to 001-test.mp3, 002-mp3, ... It doesn't matter which file gets which name. have written a batch file to do the rename. Here is my code (with line numbers added): 01 rem @echo off 02 cls 03

Rename files sequentially in python

限于喜欢 提交于 2019-12-10 00:03:16
问题 Hi i'm trying to rename my files in a directory from (test.jpeg, test1.jpeg, test2.jpeg etc...) (People-000, People-001, People-002 etc...) but I haven't found a good way to do that anywhere online. I'm kinda new to python but if I figured this out it would be very useful. 回答1: If you don't mind correspondence between old and new names: import os _src = "/path/to/directory/" _ext = ".jpeg" for i,filename in enumerate(os.listdir(_src)): if filename.endswith(_ext): os.rename(filename, _src+

Rename file in c#.net when its is uploaded through file upload control and save chang name of file in database

社会主义新天地 提交于 2019-12-09 17:12:26
问题 I have file uploader through which i browse file and strore the name of of browse file in string variable . now i want rename this uplaod file name with another name which stored in another string variable string strRoleValue = ddlrole.SelectedValue; string strfilename = FileUpload1.FileName; string existpath = Server.MapPath("~\\JD\\"); DirectoryInfo ObjSearchFile = new DirectoryInfo(existpath); string saveLocation = existpath + strfilename; FileUpload1.SaveAs(saveLocation); strRoleValue

Rename file in DocumentDirectory

 ̄綄美尐妖づ 提交于 2019-12-09 07:46:37
问题 I have a PDF file in my DocumentDirectory . I want the user to be able to rename this PDF file to something else if they choose to. I will have a UIButton to start this process. The new name will come from a UITextField . How do I do this? I'm new to Swift and have only found Objective-C info on this and am having a hard time converting it. An example of the file location is: /var/mobile/Containers/Data/Application/39E030E3-6DA1-45FF-BF93-6068B3BDCE89/Documents/Restaurant.pdf I have this code

How do I rename a file in JGit

孤人 提交于 2019-12-09 03:39:06
问题 How do I rename a file in JGit. That is, given a working file named file1. The command line would be: git mv file1 file2 回答1: There is no direct equivalent to git mv in Git. git mv is just a short hand for mv oldname newname git add newname git rm oldname (see here) Respectively, use File.renameTo() or, since Java 7, Files.move() to move the file and then git.add().addFilepattern( "newname" ).call(); git.rm().addFilepattern( "oldname" ).call(); to update the Git index. The paths given to

Rename a file in the internal storage

南楼画角 提交于 2019-12-08 16:33:27
问题 What's the best/easiest way to rename a file in the application's internal storage? I find it a bit strange that there is a Context.deleteFile() method, but no "move" or "rename" function. Do I have to go all the way through saving the file's contents, deleting it, creating a new one and then copying the contents into that one? Or is there a way to copy a file over an existing file? Update (Aug. 30, 2012): As per the suggested solution below, which I cannot get to work: I have a file called

Renaming multiple files using a Shell Script

ぃ、小莉子 提交于 2019-12-08 14:33:59
问题 I have files named t1.txt , t2.tx t, t3.txt ... t4.txt and I need a shell script to rename it like this: file one: M.m.1.1.1.201108290000.ready file two: M.m.1.1.1.201108290001.ready etc, the sequence number in the last 4 digits changes. I'd be grateful if someone helped me :) Best Regards 回答1: This might be what you need: cd /home/me/Desktop/files/renam/ n=201108290000 for file in *.txt; do echo $file prefix=M.m.1.1.1. file_name=M.m.1.1.1.$n.ready echo $file_name n=$(( $n+1 )) mv $file $file

Batch file with time issue before 10 AM

戏子无情 提交于 2019-12-08 13:20:41
问题 I have created a batch script to take a file, copy it to a folder with the date and time as the folder name and then to rename the file also based off the date and time. My issue is that any time before 10 AM, the command fails: c:\ICVERIFY\ICWin420\DATADIR>md C:\SettlementReports\Settlement_Reports\DATADIR\ 06-25-2014_ 709_08.24.txt A subdirectory or file C:\SettlementReports\Settlement_Reports\DATADIR\06-25-201 4_ already exists. Error occurred while processing: C:\SettlementReports

batch file to find files with double file extensions and remove the last one

折月煮酒 提交于 2019-12-08 12:18:20
问题 I have several folders that have files with double file extensions along with regular file extensions. I need to create a batch script to search all the folders and remove the last extension with any files that have double extensions. None of the file extensions are consistent. Here's an example C:\test\regular.exe C:\test\picture.jpg.doc C:\newtest\document.doc.pdf End Result I need C:\test\regular.exe C:\test\picture.jpg C:\newtest\document.doc 回答1: @ECHO OFF SETLOCAL SET sourcedir=c:

For Loop in Batch File Renames One File Twice

荒凉一梦 提交于 2019-12-08 10:08:21
问题 I wrote this batch file to append some text to the filenames of a set of jpeg files, giving the option to append them before or after the current filename. But for some odd reason when appending before the filename, one file is being proccessed twice getting the result as new_new_FileName.jpg while all other files are getting just new_FileName.jpg. Interesting enough, this problem isn't happening always, as well as when appending after the filename it is always working fine. Following is the