Skip to content

Instantly share code, notes, and snippets.

@andytlr
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save andytlr/c192f7169e7323efddfb to your computer and use it in GitHub Desktop.

Select an option

Save andytlr/c192f7169e7323efddfb to your computer and use it in GitHub Desktop.

Revisions

  1. andytlr revised this gist May 21, 2014. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -3,15 +3,15 @@ while read line ; do
    let n=n+1
    filename=`basename "$line"`
    dropboxuser=21267 # Replace with your ID
    permanent_directory=/shots/keep/ # This is the full path iside your Public Dropbox directory. The slashes are important.
    permanent_path=~/Dropbox/Public$permanent_directory
    mkdir -p $permanent_path
    date=$(date +%M%H%S)-
    if [ -f $permanent_path$filename ] ;then
    mv $line $permanent_path$date$filename
    printf https://dl.dropboxusercontent.com/u/$dropboxuser$permanent_directory$date$filename | pbcopy
    directory=/shots/keep/ # This is the full path iside your Public Dropbox directory. The slashes are important.
    path=~/Dropbox/Public$directory
    mkdir -p $path
    date=$(date +%H-%M-%S)-
    if [ -f $path$filename ] ;then
    mv $line $path$date$filename
    printf https://dl.dropboxusercontent.com/u/$dropboxuser$directory$date$filename | pbcopy
    else
    mv $line $permanent_path$filename
    printf https://dl.dropboxusercontent.com/u/$dropboxuser$permanent_directory$filename | pbcopy
    mv $line $path$filename
    printf https://dl.dropboxusercontent.com/u/$dropboxuser$directory$filename | pbcopy
    fi
    done
  2. andytlr revised this gist May 21, 2014. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -2,15 +2,16 @@ n=0
    while read line ; do
    let n=n+1
    filename=`basename "$line"`
    permanent_directory=/shots/keep/ # This is the full path iside your Public Dropbox directory.
    dropboxuser=21267 # Replace with your ID
    permanent_directory=/shots/keep/ # This is the full path iside your Public Dropbox directory. The slashes are important.
    permanent_path=~/Dropbox/Public$permanent_directory
    mkdir -p $permanent_path
    date=$(date +%M%H%S)-
    if [ -f $permanent_path$filename ] ;then
    mv $line $permanent_path$date$filename
    printf https://dl.dropboxusercontent.com/u/21267$permanent_directory$date$filename | pbcopy
    printf https://dl.dropboxusercontent.com/u/$dropboxuser$permanent_directory$date$filename | pbcopy
    else
    mv $line $permanent_path$filename
    printf https://dl.dropboxusercontent.com/u/21267$permanent_directory$filename | pbcopy
    printf https://dl.dropboxusercontent.com/u/$dropboxuser$permanent_directory$filename | pbcopy
    fi
    done
  3. andytlr revised this gist May 21, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ n=0
    while read line ; do
    let n=n+1
    filename=`basename "$line"`
    permanent_directory=/shots/keep/
    permanent_directory=/shots/keep/ # This is the full path iside your Public Dropbox directory.
    permanent_path=~/Dropbox/Public$permanent_directory
    mkdir -p $permanent_path
    date=$(date +%M%H%S)-
  4. andytlr revised this gist May 21, 2014. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,12 @@ while read line ; do
    permanent_directory=/shots/keep/
    permanent_path=~/Dropbox/Public$permanent_directory
    mkdir -p $permanent_path
    mv $line $permanent_path
    printf https://dl.dropboxusercontent.com/u/21267$permanent_directory$filename | pbcopy
    date=$(date +%M%H%S)-
    if [ -f $permanent_path$filename ] ;then
    mv $line $permanent_path$date$filename
    printf https://dl.dropboxusercontent.com/u/21267$permanent_directory$date$filename | pbcopy
    else
    mv $line $permanent_path$filename
    printf https://dl.dropboxusercontent.com/u/21267$permanent_directory$filename | pbcopy
    fi
    done
  5. andytlr revised this gist May 20, 2014. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,9 @@ n=0
    while read line ; do
    let n=n+1
    filename=`basename "$line"`
    mkdir -p ~/Dropbox/Public/shots/keep/
    mv $line ~/Dropbox/Public/shots/keep/
    printf https://dl.dropboxusercontent.com/u/21267/shots/keep/$filename | pbcopy
    permanent_directory=/shots/keep/
    permanent_path=~/Dropbox/Public$permanent_directory
    mkdir -p $permanent_path
    mv $line $permanent_path
    printf https://dl.dropboxusercontent.com/u/21267$permanent_directory$filename | pbcopy
    done
  6. andytlr revised this gist May 20, 2014. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,8 @@
    n=0
    while read line ; do
    let n=n+1
    old_path='\/Users\/andytlr\/Dropbox\/Public\/Shots\/'
    filename=`echo $line | sed -e "s/$old_path//g"`
    filename=`basename "$line"`
    mkdir -p ~/Dropbox/Public/shots/keep/
    mv ~/Dropbox/Public/shots/$filename ~/Dropbox/Public/shots/keep/$filename
    mv $line ~/Dropbox/Public/shots/keep/
    printf https://dl.dropboxusercontent.com/u/21267/shots/keep/$filename | pbcopy
    done
  7. andytlr revised this gist May 20, 2014. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,9 @@
    #!/bin/sh -u
    n=0
    while read line ; do
    let n=n+1
    old_path='\/Users\/andytlr\/Dropbox\/Public\/Shots\/'
    filename=`echo $line | sed -e "s/$old_path//g"`
    echo $filename
    mkdir -p ~/Dropbox/Public/shots/keep/
    mv ~/Dropbox/Public/shots/$filename ~/Dropbox/Public/shots/keep/$filename
    printf https://dl.dropboxusercontent.com/u/21267/Shots/keep/$filename | pbcopy
    done
    printf https://dl.dropboxusercontent.com/u/21267/shots/keep/$filename | pbcopy
    done
  8. andytlr revised this gist May 20, 2014. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,10 @@
    #!/bin/sh -u
    n=0
    while read line ; do
    old_path='\/Users\/andytlr\/Dropbox\/Public\/Shots'
    new_path='\/Users\/andytlr\/Dropbox\/Public\/Shots\/π'
    let n=n+1

    echo $line | sed -e "s/$old_path/replace/g"
    done

    # this looks interesting http://teaching.idallen.com/dat2330/04f/notes/shell_read.txt
    old_path='\/Users\/andytlr\/Dropbox\/Public\/Shots\/'
    filename=`echo $line | sed -e "s/$old_path//g"`
    echo $filename
    mv ~/Dropbox/Public/shots/$filename ~/Dropbox/Public/shots/keep/$filename
    printf https://dl.dropboxusercontent.com/u/21267/Shots/keep/$filename | pbcopy
    done
  9. andytlr revised this gist May 20, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,6 @@ while read line ; do
    let n=n+1

    echo $line | sed -e "s/$old_path/replace/g"
    done
    done

    # this looks interesting http://teaching.idallen.com/dat2330/04f/notes/shell_read.txt
  10. andytlr created this gist May 20, 2014.
    9 changes: 9 additions & 0 deletions movefilesandcopy.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/bin/sh -u
    n=0
    while read line ; do
    old_path='\/Users\/andytlr\/Dropbox\/Public\/Shots'
    new_path='\/Users\/andytlr\/Dropbox\/Public\/Shots\/π'
    let n=n+1

    echo $line | sed -e "s/$old_path/replace/g"
    done