rename

VBS script to rename files using the pathname

半世苍凉 提交于 2019-12-12 03:41:38
问题 i am new to VBS scripting and I have done few stuff with Excel VBA before. Now I have a script which renames single files with the pathname of the files (truncated to 4 letter each))see below. It is some script which I modified a bit to fit my purpose. However, I would like to automatize the file rename process and rename all files in a folder and its subfolders in the same way the scipt works for single files. Can anybody help me with this question? Set Shell = WScript.CreateObject("WScript

Need to rename the URL using htaccess

只谈情不闲聊 提交于 2019-12-12 03:34:52
问题 I have tried a lot, but no luck. My requirements are below. Need to rename URL from one to another ex: /checkout/idnumber/checkout_direct to /booking/idnumber/ Note: id number is automatically generated Need to get same ID number in renaming url too (id number will vary) Please help me to solve this issue. Thanks in Advance. 回答1: You cold use in your .htaccess file the following code (note that this isn't a working code, because if you have the URL "/checkout/idnumber/checkout_direct" it

Cycle through sub-folders to rename files in Powershell

只谈情不闲聊 提交于 2019-12-12 03:33:58
问题 I have a file directory that contains many folders within it. Inside each of these sub-folders, I have a variety of files. I would like to go through each file, rename some of the items, and add extensions to some of them. I am using Powershell to do this. I have file names with "." that all need to be replaced with "_" for example, "wrfprs_d02.03" should be "wrfprs_d02_03". I was able to successfully do that in one folder with the following code: dir | rename-item -NewName {$_.name -replace

Rename-item in multiple subfolders

六眼飞鱼酱① 提交于 2019-12-12 03:03:45
问题 I have a piece of software which looks for a files named "report.txt". However, the text files aren't all named report.txt and I have hundreds of sub folders to go through. Scenario: J:\Logs 26-09-16\log.txt 27-09-16\report270916.txt 28-09-16\report902916.txt I want to search through all the sub folders for the files *.txt in J:\logs and rename them to report.txt . I tried this but it complained about the path: Get-ChildItem * | Where-Object { !$_.PSIsContainer } | Rename-Item -NewName { $_

Java: DefaultMutableTreeNode Event When Renamed

十年热恋 提交于 2019-12-12 01:48:30
问题 I created a class that extends DefaultMutableTreeNode. It has a variable, "resource" of the type Resource so that it can be linked to an object without that object affecting its name. The Resource class has a variable, "name" that I would like to be changed when its corresponding DefaultMutableTreeNode is renamed, but I can't find any such events. 回答1: In DefaultTreeCellEditor there is this method: http://docs.oracle.com/javase/7/docs/api/javax/swing/tree/DefaultTreeCellEditor.html

Recursively renaming folders and files to sub-directory name and moving files

柔情痞子 提交于 2019-12-12 01:23:23
问题 I have several sub-directories with no unanimous naming pattern within my home directory (for example ~/123 , ~/456 , ~/789 ). Within each of these sub-directories, I have two folders named alignment1 and alignment2 . In the folders alignment1 and alignment2 there are several files. The files of interest to me are named alignment1 (no extension) in the alignment1 folder and the file alignment2 (no extension) in the alignment2 folder. Please remember that in the folders alignment1 and

auto renaming batch file

五迷三道 提交于 2019-12-12 01:04:56
问题 I need to create a batch file that will strip the first four characters from a file name and dump the rest. so basically I may have file "1234_whatever.txt" and I need it to rename the file to "1234.txt" The format of the file name will always be the same however the filenames will always change. On top of that I need this to be all automatic with no user intervention. any help would be appreciated 回答1: @ECHO OFF SETLOCAL SET "sourcedir=." FOR %%a IN ("%sourcedir%\*_*.*") DO ( FOR /f "tokens

Rename a snapshot in Hyper-V WMI V2 from C#

别说谁变了你拦得住时间么 提交于 2019-12-11 23:55:33
问题 I am trying to rename a Hyper-V snapshot (checkpoint) using root\virtualization\v2. None of the standard methods like ModifySystemSettings or ModifyVirtualSystem of Msvm_VirtualSystemSnapshotService or Msvm_VirtualSystemManagementService has been helpful so far. Powershell Rename-VMSnapshot can do the job however I am not sure it is using WMI. Any idea? 回答1: Here is what worked for me: // // Rename last snapshot to desired name // using (ManagementBaseObject inParams = vmms

Strip whitspace and make lower case up to hyphen - filename

雨燕双飞 提交于 2019-12-11 20:57:34
问题 I have a lot of text files which I am renaming with a specific format. Below I am able to remove whitespaces and make lower case. However, it is not the desired outcome. How would I be able to format(take out spaces and make lower case) everything up the hyphen and then take only the first white space after the hyphen? find /temp/ -depth -name "* *" -type f -exec rename 's/ +\././; y/A-Z /a-z_/' {} + Input Result: Hello Video - KEEP.txt Output: hello_video_-_keep.txt Desired result: hello

Rename Files Based On Folder Name

纵饮孤独 提交于 2019-12-11 20:57:00
问题 I am using the following script to rename (prefix) files in subfolders with the string "Application". pushd "%temporarydirectory%" for /r %%j in (*) do ( rename "%%j" "Application - %%~nxj" ) Popd For example files in: C:\temp\Lodgements\10 Smith Street 10001.doc 10002.doc Are renamed to: Application - 10001.doc Application - 10002.doc What I would like to do is to change the script so that files are renamed (prefixed) with the name of the folder in which they are contained. For example files