Rename a lot of files in subdirectories with multiple file extenisons - file

So I have a very big folder full of more folders which hold files that all have their regular extension, but then with ,v after it (like .xml,v)
Is there a quick way/program to make it go through all of the folders and when it finds a ,v it'll remove the ,v from it?
Thanks
EDIT: I am running Windows 7 (64-bit). Also please remember than I am an idiot :P

Use find to list the files ending ,v. Pipe the output to a shell loop that renames the files.
${f%%,v} matches the file name without the ,v suffix.
find . -name \*,v | while read f; do mv $f ${f%%,v} ;done

Not clear, Where you have the files? (In your computer / on a server).
What is the platform (Windows / Linux) ...
There are multiple ways to solve it based on scenario (like a tiny batch file can do it in a flash if the folder is in your local computer with windows platform) ...

Related

How to extract a set of *.tar.gz.(letters) files?

I have downloaded a medical data set to use in machine learning and the files are like this:
dicom_v1.tar.gz.aa
dicom_v1.tar.gz.ab
dicom_v1.tar.gz.ac
dicom_v1.tar.gz.ad
I don't know how to extract these files. When I use WinRAR or 7-Zip, it doesn't work.
It is written in the attached ReadMe file:
To decompress this data set execute in a Unix command line:
cat dicom_archive.tar.* | tar -xzvf
How can I do this in Windows 10 as I am a beginner?
These files have been split into chunks for distribution, so you need to put them back together before you can see whether Winrar or 7-zip will be able to extract them.
Since you're using Windows, you probably want to the Powershell get-content command (which helpfully aliased to cat btw) - and since the files are chunks of a compressed archive you probably want to use the -raw argument too.
https://shellgeek.com/use-cat-equivalent-type-command-in-windows/ is a good page to read.
I would try something like this as a starting point:
PS C:\> get-content -raw dicom_v1.tar.gz.* > dicom_v1.tar.gz
According to https://pureinfotech.com/extract-tar-gz-files-windows-10/ you should be able to run tar with the z flag natively in Powershell to extract all the files from the dicom archive.

Batch script to process media files

I am very happy to have found this place.
I have an external drive I use for my media and as I am switching to Kodi as my media player, there are some changes I need to make.
The drive has many many directories and in each directory there is an image file to accompany said media file. Example:
filename1.mp3
filename1.jpg
Of course the filename varies as does the amount of files, though each file does have a respective image. I need to recursively sweep the drive and have it make copies of whatever the jpg and the final result should be something like this:
filename1.mp3
filename1.jpg
filename1-poster.jpg
poster.jpg
What would be the best way to accomplish this? It's thousands of files so its really beyond the scope of doing this manually.
I do certainly appreciate any assistance or insight anybody can provide to accomplish this monumental task.
Best regards,
Peter
A simple solution (unix shell, e.g. ksh, bash) and not necessarily safe against spaces in file names would be:
for file in $(find . -name '*.mp3') ; do
base="${file%%.mp3}"
cp "$base.jpg" "$base-poster.jpg"
cp "$base.jpg" "$(dirname $base)/poster.jpg"
done

Rename Multiple files in a Unix Directory by removing characters

I would like to rename Multiple files in a Unix Directory using Ksh Command.
Eg ATT8-2011-10-01 00:00:00-MSA-IMM-SINGLE_AND_FAMILY_COVERAGE-DED-$2000-X114817.PDF
needs to be renamed as
ATT8-2011-10-01-MSA-IMM-SINGLE_AND_FAMILY_COVERAGE-DED-$2000-X114817.PDF
Basically the time portion which is always 00:00:00 needs to be stripped off and the space between the date and the next hyphen symbol (-) needs to be compressed.
Any ideas as to how to this ? Assuming they are about 3000 files in the directory.
On some systems, there is a Perl-based rename command (sometimes called prename) and you'd write:
rename 's/ 00:00:00//' *" 00:00:00-"*
If you don't have that, find it. If you can't find it, then you have more work to do. However, the work is searching on SO. For example, Underscore in rename command (Perl and Unix shell) has a link to one version of the prename (Perl rename) command.

How to list directories on an OpenVMS volume

I've been searching Google as well as the OpenVMS System Administrator's Guide and User Guide, and still can't find anything regarding listing the directories present on an OpenVMS volume. I can't see how this could taken for granted in the docs, since everything else is very specific, so either I'm failing to see it or it can't be done. If it can't be done, then I'm missing some incredibly large chunk of the picture in regards to using VMS. Any suggestions are appreciated.
TIA,
grobe0ba
By "listing", I assume you mean via a command such as Dir...
To see all directories on a volume I would do something like,
$ dir volumeid:[000000...]*.dir
Of course, you need enough privilege to be able to see all the directories on the volume.
For a quick overview of all the directories you may also check out the /TOTAL option for 'directory'.
$ DIRE /TOTAL [*...]
Add /SIZE for effect (and slowdown)
You can of course post process to your hearts content...
$ pipe dir /total data:[*...] | perl -ne "print if /^Dir/"
Directory DATA:[CDC]
Directory DATA:[CDC.ALPHA]
Directory DATA:[CDC.ALPHA.V8_3]
$ pipe dir /total data:[*...] | searc sys$pipe "ory "
Directory DATA:[CDC]
Directory DATA:[CDC.ALPHA]
Directory DATA:[CDC.ALPHA.V8_3]
$ pipe dir /total data:[*...] | perl -ne "chomp; $x=$1 if /^Di.* (\S+)/; printf qq(%-60s%-19s\n),$x,$_ if /Tot/"
DATA:[CDC] Total of 7 files.
DATA:[CDC.ALPHA] Total of 1 file.
DATA:[CDC.ALPHA.V8_3] Total of 11 files.
Finally, if you are serious about playing with files and directories on OpenVMS, be sure to google for DFU OPENVMS ... download and enjoy.
Unfortunately I do not have the reputation required for commenting so I have to reformulate the answer.
#ChrisB
This answer while voted is not correct generally speaking. Directories are always files ending with .DIR and having a version of 1. Renaming a directory to *.DIR;x with x>1 will render the directory not traverseval. The DIR file however retains its directory characteristics and renaming it back to ;1 will return its normal behavior.
So one may add a ;1 to the DIR command
$ dir volumeid:[000000...]*.dir;1
But again this is not valid because any one may create *.DIR files which are not directories (ex. EDIT TEST.DIR), and there are applications out there doing so.
#Hein
So the second answer from Hein, which at this time does have 0 votes, is the corretc one. The one that does exactely the requested operation without 3rd party tool is:
$ PIPE DIR /TOTAL volume:[*...] | SEARCH SYS$PIPE "ory "
This command will only show valid directories

How to remove specific characters from a file name?

I have bunch of files that need to have a (.) dot removed from the file-name. Eg. "Mr.-John-Smith.jpg" to "Mr-John-Smith.jpg". I don't have real experience with programming and know only html/css and a little javascript. I found another identical question here on stackoverflow, but what I gathered it was fixed on linux system and BASH was used.
Anyways, if anyone could provide me a tutorial on which program to use for this and what code to execute in that program to make it happen I'd be grateful.
if you are using a windows environment (which i guess you do)
you can download this free utility to mass change file names !
main page :
http://www.bulkrenameutility.co.uk/Main_Intro.php
download page :
http://www.bulkrenameutility.co.uk/Download.php
its easy to use
enjoy
If your file names in a file...
1- Open Microsoft Word or any text editor. Press ctrl+h and then search "." without quotes then replace it with blank character.
2- It will remove all dots, again bring "." to your file extention such as .jpg , .png searh your file extention for example "jpg" and replace it with ".jpg"
It will works %100, i am using this method everytime.
if they are not in a file and if you want do somethings in your operation systems' file system
Try this program. It is very useful for this operation;
Download
To remove all except the extension dot from all files in a directory, you can use PowerShell that comes with newer versions of Windows, and can be downloaded for older versions;
Line breaks inserted for readability, this should go on one line;
PS> dir | rename-item -newname {
[System.IO.Path]::GetFileNameWithoutExtension($_.name).Replace(".","") +
[System.IO.Path]::GetExtension($_.name); }
What it does is to take the file name without an extension and remove all dots in it, and then add back the extension. It then renames the file to the resulting name.
This will change for example do.it.now to doit.now, or in your case, Mr.-John-Smith.jpg to Mr-John-Smith.jpg.

Resources