Ubuntu Networking :: Bulk Renaming Files On A SMB Share?
Jan 23, 2011
I have a Netgear ReadyNAS NV in the basement, that I want to use to serve up video files over my network to a TV in the living room.
Now, I have a lot of files that HandBrake encoded and it gave the files an m4v suffix. Even when the files are in a codec that the TV can handle, it refuses to load them because of this suffix... so I want to rename them all.
This is fairly simple for files on a local filesystem. I can simply cd into the directory containing the files, and do something like the commands below.
Code:
$ for a in `ls`;
> do
> stem=`echo ${a} | cut -f1 -d"."` ;
> mv ${a} ${stem}.mpg ;
[Code]....
Although there are a few smb commands available (smbstatus, smbget, etc.), I've not found any commands like smbls or smbmv.
Are there any special commands or utilities around that can do the kind of thing I'm trying to do?
# ls -1 *.mp3 Megadeth - Killing Is My Business...And Business Is Good! - 01 - Last Rites-Loved To Death.mp3 Megadeth - Killing Is My Business...And Business Is Good! - 02 - Killing Is My Business...And Business Is Good.mp3 Megadeth - Killing Is My Business...And Business Is Good! - 03 - Skull Beneath The Skin.mp3 [Code]....
i want to rename it to:
01 - Last Rites-Loved To Death.mp3 02 - Killing Is My Business...And Business Is Good.mp3 03 - Skull Beneath The Skin.mp3 04 - These Boots.mp3 05 - Rattlehead.mp3 06 - Chosen Ones.mp3 07 - Looking Down The Cross.mp3 08 - Mechanix.mp3
here is my RnD so far:
[Code]....
so it does show that i can run "mv" and reame the files the way i want. BUT...there are lots of spaces in each file, and hence when I append "|sh" to above command to have him actually rename the files, my "mv" command is failing. BTW, I tried exploring perl "rename" command, but I could not understand it's regex.
I need to copy a large number of files, it comes to 1 lakh from one server to another. When I tried various commands using scp , ftp etc. It is saying "Arg list too long". In which way can we copy all the files. The Two servers are under Linux.
I am using my Ubuntu machine to serve as a media server and network storage. The problem I have is iTunes on my desktop managed to make 2 copies of every song on the machine so instead of the 30GB I have its up to almost 100gb. I was wondering if there was a way to write a script to go through and delete the duplicates. The duplicates are the same filename as the original except a 1 or 2 following. Wasn't looking forward to deleting 12,000 files by hand.
I've been spinning my wheels for a bit on this one not getting any traction. I have a list of pictures that have a bad extension that I would like to rename with the good extension. Here's a snippet of the list that I'm looking at:
listold Code: /Volumes/MyFiles/Pictures/2009/02 - February/Qeirstyn Playing Inside/._IMG_3347.JPG /Volumes/MyFiles/Pictures/2009/02 - February/Qeirstyn Playing Inside/._IMG_3349.JPG /Volumes/MyFiles/Pictures/2009/02 - February/Qeirstyn Playing Inside/._IMG_3350.JPG /Volumes/MyFiles/Pictures/2009/02 - February/Qeirstyn Playing Inside/._IMG_3354.JPG
Whenever I download a file using Firefox or Google Chrome and it has a ' character on it's filename, the file is renamed and a is added before the '. It's really annoying and I'd like to know how can I solve this issue.
I've used Shotwell to give titles to a lot of photos, and now realise that I want to also rename those files using the title. I see that Shotwell saves the title into XMP IPTC structure, using this: dc:title[x]. how to batch rename a bunch of files using this data?
I am having a heck of a time trying to find directions on networking my two computers together in order to share files. I have two machines running Ubuntu 10.10 Desktop & Netbook remix.
They are both connected to my wireless router to connect to the internet.
I have a folder where all of my movies are placed. Each movie lies in its own folder. I want to write a script which renames all the movie files and gives them the name of the folder they are in.For example I want this file:/home/tryfon/movies/Black Irish [2007]/black.irish.dvdrip.avi to be renamed to /home/tryfon/movies/Black Irish [2007]/Black Irish [2007].aviOne issue is that the video files are of several file types (mostly avi, divx and mkv).Another issue is that some movies consist of two parts, so if a second avi file is found I would like the two (or more) files to be named like: "Black Irish [2007] CD1" and "Black Irish [2007] CD2", or if this is not possible at least notify me of the folders that contain more than one video fil
I have a folder with various subfolders of files. These files all have two extra characters on the end that I want to get rid of. How would I go about telling the terminal to go into X directory and every subdirectory of X directory, look for all files with the extra characters, remove them, and keep everything else the same?
I'm trying to rename files recursively from a folder. I want to delete the & from every filename. i've searched the net and found the following script:
Code: #!/bin/bash dir=/whatever/directory for file in `ls $dir` ; do # ANYCASE TO UPPERCASE: newname=`echo $file | tr '[a-z]' '[A-Z]'` mv $dir/$file $dir/$newname done and changed it:
Code: #!/bin/bash dir=/home/test for file in `find $dir -type f` ; do #rename files containing & newname=`echo $file` | tr '[&]' '' mv $dir/$file $dir/$newname done
But the for loop explodes the filename after each & sign, so i don't have a whole filename. if the file is named lorem & ipsum, the for loop will break it in 3 parts.
I managed to very stupidly (and avoidably) overwrite the hard drive that contained all my stuff--music, photos, home videos from the 80's that were painstakingly converted to digital movies, etc.After running Photorec and recovering much of the data to another disk, I'd like to be able to rename the music files using whatever exif data/tags are available.
I have many pdf files which contain "%" sign also in the name. I want to rename that all files by replacing "%" to "-" Its hierarchy of many files and folders. Is there any solution to do this at one time? OR any script for this?
What's the command for renaming files? I thought it was "mv"--I typed "info" and read
Quote:
* mv: (coreutils)mv invocation. Rename files. So, desiring to give a .JPG extension to a jpeg file that had no extension (because I dug it out of my Firefox cache), I typed
I've setup sharing on ubuntu to my windows 7 PC and it recognizes folders all folders i set to share except on my partitioned 2nd hard drive. I'm thinking its because its password protected, how do i remove this security? it shows the folder but i cannot access it
On my windows 7 it gives me: windows cannot access \usernamemovies check the spelling of the name. otherwise, there might be a problem with your network.
I just installed mediatomb so i can share files from my pc to ps3 when i try to access my slave hdd's i get this error msgs "Error: could not list directory /media/Geimsla 2 : Permission denied"
I have set up our home network with an E2000 Linksys router and we have a wireless printer on this Network 2 windows 7 pc's, 1linux (Ubuntu 10.04), 1 iMac (snow leopard), and 1 Windows Xp pc.
This might be an easy question or a tricky one but if anyone knows how to make it so that we can share files between computers and also so that they can all access the printer on the network.
So far the only ones that can see each other on the network are the Windows pc's but i am still having trouble even making it so that the Windows pc's can share files.
I created a little bash script for renaming files from a folderEvery time i hv to put that bash script file (rename.sh) in folder Is there any ways i will call (rename.sh) from terminal without moving rename.sh into any folder ?ne More Question : Whenever i run any .sh file automatically one .sh~ file created it is my programing mistake or is it exists ?
how can I rename all files in a directory up to the first dot (there by leaving the file extension alone) to the same thing? Im trying to rename all my media files and associated files in a directory to (preferably) the name of the directory it self. if I have
Code:
A Clockwork Orange - wzzyfg.cd1.avi wzzyfg.cd2.avi wzzyfg.nfo ACO.fanart.jpg orange.tbn
Id like to automatically mass rename them all to
Code:
A Clockwork Orange A Clockwork Orange.cd1.avi A Clockwork Orange.cd2.avi A Clockwork Orange.nfo A Clockwork Orange.fanart.jpg A Clockwork Orange.tbn
I have rename on my server which I used to remove underscores from file names, but I dont know how I would use it to rename everything up to the first period. Bonus points for renaming stuff to the name of the parent folder!
I have hundreds of MTS and AVI files since 2000 and would like to rename them in the following manner based on the date created: DD-MMM-YYYY HH.MM.SS_X; where X begins at 1 and increments by 1 if there are dublicate date/time stamped videos.
Ex: 19-Nov-2002 08.12.30.avi, 19-Nov-2002 08:13:30_1 and 19-Nov-2002 08:13:30_2
Someone previously wrote the following script for me, and it works great for photos. It uses EXIV2 to get the image date created info. I have tried to understand the script, but am struggling. The video files I have can use the date modified since I have not modified them since I filmed them.
#!/usr/bin/env python import os import stat import pyexiv2 import time directory = '/home/david/Desktop/test' [Code].....
I run a script which generated about 10k files in a directory. I just discovered that there is a bug in the script which causes some filenames to have a carriage return (presumably a '' character).
I want to run a sed command to remove the carriage return from the filenames.
Anyone knows which params to pass to sed to clean up the filenames in the manner described?
I am running on Linux (Ubuntu)
The character causing the filename to 'break up' accross multiple lines appear to be a CR (carriage return) instead of ' '. The filename is being diaplayed in thetitle of a text editor with %0D in the positions of where the file name breaks up. So I need to remove the CR chars from my filenames.
I'm trying to rename a lot of files getting rid of the space on the names. For that purpose I wrote this very simple bash script, but for some reason is not working.
Code: for i in "$(ls)" do j=$(echo "$i" | sed 's/ /_/g') mv "$i" "$j"
done But what I get in return for each line is just one long file name with all the file names concatenated. I've tried with echo -e "$i" as well with no results. This has to be something really simple that I'm missing but I just can't see it.
I have a bunch of files that I need to rename, ordinarily this is pretty easy task. The problem here is that the file names have Chinese / Japanese characters. ie [$$$$$$$$].SOMETHING BLAH BLAH.ext Where all the "$$$$" are insert Chinese characters. The problem is that sed or perl doesn't seem to handle the Chinese characters correctly so using a regular expression like this 's/^[*.]//' which would normally work doesn't. From what I have read so far I believe these characters are double encoded UTF-8 (not 100% sure) which could be the problem. So far I've tried numerous different regex's as well as playing around with convmv to see if I could convert the filenames to just single encoded characters but I've had no luck.
I cannot, in any way, share files between my Windows 7 and Ubuntu PCs. I have tried everything out there and nothing seems to work. I don't get why! I have samba installed, I have installed the apache2.2 packages and I have checked the network file sharing.
I can create shares with folders and I can see all the windows computers on the network (but can't access any of them).
I cannot view my Ubuntu computer from the Windows computer either.
Recently, I've again been trying to get file sharing working on my home network. I made some progress last night, getting so far as having all the shares on my Windows XP desktop visible to a netbook running Ubuntu 10.04 & connected wirelessly. But I ran into some snags.
Here's what I'm working with:
-a desktop running Windows 7 Ultimate -a desktop which dual boots Ubuntu 9.10 64-bit and Windows XP Pro SP3 -a netbook which dual boots Ubuntu Netbook Remix 9.10 and Ubuntu 10.04.
Everything connects wired except the netbook, which connects wirelessly. The router assigns each a specific internal IP address, so in effect all have static internal IP addresses, tied to the MAC addresses of their network adapters.
I have Samba Server Configuration Tool installed on both the desktop (Ubuntu 9.10) and netbook (Ubuntu 10.04). Versions are 1.2.63 in both Ubuntu 9.10 and 10.04.
Here's as far as I got last night:
-Shares on the Windows XP machine were accessible from both the Windows 7 machine and Ubuntu 10.04 on the netbook, with no password required.
-I configured Samba on both machines to be part of the same workgroup (named PENGUIN) as the Windows 7 machine and the desktop when it's running Windows XP.
-I set up a share in Samba on the netbook while running Ubuntu 10.04. The share is visible on the network from the Windows 7 machine, but I couldn't access it. I was asked for a username and login. I had no idea which one to use, but no combination I tried worked. Windows kept saying it couldn't find a "path" to the share.
-In the Nautilus "network" item on the netbook, I can see the shares on my Ubuntu 9.10 desktop. But I can't access them. Again, I get asked for a username and password, and I have no idea what to enter, or where the username and password can be set.
-I set up a share on the Windows 7 machine, allowing read-only access to everyone. But it doesn't show up on either of the Ubuntu machines, at all, in the "Penguin" workgroup. So I'm not sure how to proceed.
Do I need to explicitly configure the IPv4 settings on each machine to a static internal IP? As I stated, each machine gets a predictable address assigned by the router, so in effect the machines do have static IP addresses. However, I'm not sure that's all the same to Samba.
I want to share certain files/folders with other computers in the network. Now I know how to do this in two ways: using the GUI and modifying the smb.conf file, but the GUI may not be available (e.g. connecting to the server using SSH) and the smb.conf file takes a little bit of time to modify (and from what I have noticed by using the GUI, the smf.conf file does not get modified). Is there a way to share files/folders using only the CLI and without the need of modifying files?
Have been using Ubuntu for 18 months now - its great.Just added a second PC - both hard wired to a wireless router.Have been trying to use NFS to share files with no result.I want to share all files in "home" on PC called "Dimension".
I live in an apartment that is shared with others. We all connect to the internet through the same router. I have files I would like to share with others but have been unable to figure out how to make folders public, or how to view public folders of others and get their files.