Replace parentheses and spaces in filenames with underscore
You can use:
find /tmp/ -depth -name "*[ ()]*" -execdir rename 's/[ )]/_/g; s/\(//g' "{}" \;
Rename files with spaces to underscore in all subcategories
Thanks to @Barmar. I used command from answer https://unix.stackexchange.com/questions/223182/how-to-replace-spaces-in-all-file-names-with-underscore-in-linux-using-shell-scr/223185#223185
Just make sure its in two lines
Batch rename - remove parentheses and whitespace and have leading zero
What you're trying to do is fairly trivial:
Get-ChildItem '#20AR*.doc' | Rename-Item -NewName { $_.Name -replace ' \((\d)\)','0$1' -replace ' \((\d\d)\)','$1' }
Regex Search and Replace spaces into underscores
I actually don't think this one is possible in a reasonable way with a single replace. you might want to do globally replace all spaces with underscores, and then replace things like "alt with " alt, etc.
HttpResponse substituting underscores for spaces in file names
If anyone is still interested:
This kind of file name rewriting is done by the browser only as you can see when inspecting the received HTTP response with an appropriate tool, independent of the browser used. IE first downloads the requested file into its "Temporary Internet Files" folder system (which is not just one, but this is another topic), and for this purpose the file receives a new name, making best match to the "Content-Disposition" suggestion from the HTTP response. But if an equally named file is already present in the actual "Temporary Internet Files" folder actually used for this file, its name is extended by a sequenced number in brackets, like "[2]". Because every new HTTP request causes the IE cache mechanism to newly compute the actual cache folder, and the next cache folder chosen may not yet contain a file with that name, the number may seem to vanish at the next download of a file or resource with the same name.
If a downloaded file is stored somewhere, the originally suggested file name is used again usually, depending on the IE version. Some versions and patch levels seem to use the cache folder file name instead :-(
The problem starts to become annoying when the browser hands out a downloaded file to a chosen or automatically selected application. In this case the application is called to open the file directly from the cache, which is bad for at least 2 reasons:
(1) The file name will be the name of the file in the cache folder, not the suggested name. This may even strip the extension, which will confuse some applications even if they have been chosen for handling the file correctly.
(2) If an internet newbie user downloads and opens a file for editing and then simply presses the "Save" button of the application, the file is simply saved into the IE cache folder, and no user of this kind will ever find this file again. These are things which can turn people really angry and desperate...
Related Topics
Linux Script- Date Manipulations
Where Is $Path Set? Specifically Where Is My MAC Port Path Being Set
Ada Compiler Crashes with "Ada Compiler Not Installed on This System." After Downgrading Gcc Version
Copying Files from Multiple Directories into a Single Destination Directory
Shell Command to Get Directory with Least Access Date/Time
Python3 Mlpy Installation Error - 'Py_Initmodule3' Was Not Declared in This Scope
Which Capabilities Are Needed for Statx to Stop Giving Eperm
Overhead of Supporting Floating Point Arithmetic Inside the Linux Kernel
How to Prevent an X Window from Receiving User Input
How to Extract Patterns Form a Text Files in Shell Bash
How to Configure Acpi *.Asl for a Virtual Mdio-Gpio Device Connected to a I2C Gpio Expander