zsh, zmv mass rename sub directories nothing happening on large volume of directories



I've set

autoload -U zmv
alias mmv='noglob zmv -W'

When on sample data (~20 folders with subfolders) I run

mmv images/**/advert images/**/notice

it just works as expected. But if I run same command on real data (hundreds of thousands folders), nothing happends. I've run mmv -n to get some messages but no result. Even one directory name was changed so after I while I just ended the process.

Is zmv cache folder list as a first step and than it replace names? I expected that zmv will start changing names immediately dir by dir.

Should I run mvv and just wait for few hours?


Related to : zsh, zmv mass rename sub directories nothing happening on large volume of directories
[SOLVED] Help with script to mass rename 1k+ directories
Network & Servers
I just noticed that all my old photos on my backup are stored in some different directory naming conventions than my newer ones and renaming everything by hand... well lets just say that there is 1000 plus directories that needs fixing and I've let myself become extremely rusty in scripting :roll:
Does anyone have time on their hands to write a small script that mass renames them for me? [-o<
What I got:
(YEAR) XXX YYY
XXX YYY (YEAR)
How they should be named:
YEAR - XXX YYY
Examples:
From this:
[all variants] [solved!] Mass renaming multiple directories!
Network & Servers
Can anyone give me some command line renaming help?
I foolishly decided to rename all my media directories with the year the show was made at the end of it. For instance:
/television/Dallas (2012)
//01) Season One
//02) Season Two
/television/Downton Abbey (2010)
//01) Series One
//02) Series Two
Now XBMC insists on asking me to rename the show every time I do an import.
Can any of you recommend a command line renaming sequence that would simply strip the directory name of the space, parenthesis, date , parenthesis?
Thanks! I'd really hate to have to manually rename everything all
Recursively rename files and directories
Network & Servers

I'm using this command to rename files:

for fname in *;
do
    mv "$fname" $(echo "$fname" | sha1sum | cut -f1 -d' ')
done

But it only renames in the current directory. Let's say I have many directories, and each directory contains some other directories, and last directory tree contains files. I want to rename them with random characters.

I think find . -type f should work, and have tried it, but still did not get any working command.


How can i create recursively child directories on my ftp server untill done all directories and directories with capital chars?
Network & Servers

This is the method i'm using to create directory on my ftp server.

public void createDirectory(string newDirectory)
        {
            try
            {
                string FtpHost = f.Host + "/" + newDirectory;
                if (!FtpHost.ToLower().StartsWith("ftp://"))
                    FtpHost = "ftp://" + FtpHost;
                ftpRequest =
(FtpWebRequest)WebRequest.Create(FtpHost);
                ftpRequest.Credentials = new
NetworkCredential(f.Username, f.Password);
                ftpRequest.UseBinary = true;
                ftpRequest.UsePassive = true;
                ftpRequest.KeepAlive = true;
                ftpRequest.Method =
WebRequestMethods.Ftp.MakeDirectory;
                ftpResponse1 =
(FtpWebResponse)ftpRequest.GetResponse();
                ftpResponse1.Close();
                ftpRequest = null;
            }
            catch (Exception ex) { Console.WriteLine(ex.ToString()); }
            return;
        }

The problem and why i need to make recursive loop is for example this case:

If in the textBox i type a directory like this: c/1/2/3/4/5 and on my ftp server child/sub directories under c 1/2/3/4 not exist not created yet before it will throw exception. But if i manualy type in the textBox once c/1 it will create the directory fine. Then i type c/1/2 will create it fine. Then i type c/1/2/3 will create fine. Then i type c/1/2/3/4 will create fine. Then if type or paste to the textBox c/1/2/3/4/5 it will create it fine since all the directories 1/2/3/4 already exist so it will create directory 5 not problems.

For some reason it dosen't understand or know to create the child/sub directories if some of them not exist yet already. It will not create c/1/2/3/4/5/6/7/8 it will not create directory 8 if 1/2/3/4/5/6/7 already created.

That's why i need to make some loop recursive that will also check if the directories exist on my server and then to create them if not for example: c/1/2/3/4/5/6/7/8 The loop should check if c/1 exist if not create then create c/1/2 then c/1/2/3 untill c/1/2/3/4/5/6/7/8 and in case the directories c/1/2/3/4/5/6 already exist but i typed c/1/2/3/4/5/6/7/8 the loop should find that untill 6 the directories exist already so to create only /7/8

The exception in in all cases there was exception is the same but i'm sure this is the problem that i need to make somehow recursive loop that also will check if the child/sub directories already exist.

WebException

The remote server returned an error: (550) File unavailable (e.g., file not found, no access)

System.Net.WebException was caught
  HResult=-2146233079
  Message=The remote server returned an error: (550) File unavailable
(e.g., file not found, no access).
  Source=System
  StackTrace:
       at System.Net.FtpWebRequest.CheckError()
       at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
       at System.IO.Stream.Close()
       at System.Net.ConnectionPool.Destroy(PooledStream pooledStream)
       at System.Net.ConnectionPool.PutConnection(PooledStream
pooledStream, Object owningObject, Int32 creationTimeout, Boolean
canReuse)
       at System.Net.FtpWebRequest.FinishRequestStage(RequestStage
stage)
       at System.Net.FtpWebRequest.GetResponse()
       at FTP_ProgressBar.FtpProgress.createDirectory(String
newDirectory) in c:ftp_progressbarFTP_ProgressBarFtpProgress.cs:line
295
  InnerException: 

Line 295 is:

ftpResponse1 = (FtpWebResponse)ftpRequest.GetResponse();

How to efficiently rename all files/directories with same name?
Network & Servers

I'm trying to rename a few common files/directories in my music collection. As of now, my music library is organized this way:

Music
    Artist
        Album
            Song
            Song
            Song
            .Cover.jpg
            .Scans

I would like to change the .Cover.jpg and .Scans to something different, like:

Music
    Artist
        Album
            Song
            Song
            Song
            Cover.jpg
            Artwork

However, I can't find a good way to rename all of these files and directories via bash. How could I make this work so that I won't have to rename every single file manually?

Also, in case I sometime in the future change my mind about how I have things named, how can I change the .Scans directory to simply Scans in every directory under Music?


zsh, zmv mass rename sub directories nothing happening on large volume of directories
Network & Servers

I've set

autoload -U zmv
alias mmv='noglob zmv -W'

When on sample data (~20 folders with subfolders) I run

mmv images/**/advert images/**/notice

it just works as expected. But if I run same command on real data (hundreds of thousands folders), nothing happends. I've run mmv -n to get some messages but no result. Even one directory name was changed so after I while I just ended the process.

Is zmv cache folder list as a first step and than it replace names? I expected that zmv will start changing names immediately dir by dir.

Should I run mvv and just wait for few hours?



Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .