Search:

Type: Posts; User: Vaphell; Keyword(s):

Search: Search took 0.07 seconds.

  1. Replies
    21
    Views
    1,810

    [SOLVED] Re: Help needed with file sorting

    rename works with the same expressions (eg s/from/to/). In my example i cut main part of the name ($1), original extension ($2) and the number between ~ ~ ($3) and construct the new name off these...
  2. Replies
    21
    Views
    1,810

    [SOLVED] Re: Help needed with file sorting

    renaming will be fine

    $ rename -nv 's/(.+)[.]([^.]+)[.]~(.+)~/$1--$3.$2/' *~*~
    test.txt.~1~ renamed as test--1.txt
    test.txt.~2~ renamed as test--2.txt
    test.txt.~3~ renamed as test--3.txt...
  3. Replies
    21
    Views
    1,810

    [SOLVED] Re: Help needed with file sorting

    add -v switch to make mv verbose and check what happens
    you should get something like this:


    `1/2/test.txt' -> `txt/test.txt'
    `1/test.txt' -> `txt/test.txt' (backup: `txt/test.txt.~1~')...
  4. Replies
    21
    Views
    1,810

    [SOLVED] Re: Help needed with file sorting

    in theory exactly that should happen.
    yes, echoing first is a smart thing to do, never run mv/rm if you are not absolutely sure what will happen as there is no undo.
  5. Replies
    21
    Views
    1,810

    [SOLVED] Re: Help needed with file sorting

    1. it's easy to automate find


    ext=( "*mp3" "*avi" )
    find_opt=()
    for e in "${ext[@]}"
    do
    (( ${#find_opt[@]} )) && find_opt+=( "-o" )
    find_opt+=( "-iname" "$e" )
    done
Results 1 to 5 of 5