Git Product home page Git Product logo

make-lowercase-rename's Introduction

Make lowercase rename

Quick, dirty and hacky PHP script (with a terrible project name).

Given a source directory, spits out to the console a bash script to recursively rename uppercase filenames to lowercased versions - basically a bunch of mv "sourcefile" "sourcefilelowercase" commands. It will not modify directories, only the files within.

Something I needed to lowercase around 30,000 digital camera images on a NAS drive which has a rather limited toolchain (BusyBox).

I'm sure I could have done this directly on the NAS using bash, but it proved easier/quicker to:

  • Cobble this together
  • Run script over NFS share to the files in question
  • SCP result over to NAS as bash script
  • Run bash script directly on the NAS from it's BusyBox shell

This will be little to zero use for anyone else but me.

Tested under PHP 7.2.x.

Usage

Note: The second optional argument --move-temp will first move the source file to a temp filename, then back to it's final lowercased filename. This defeats issues with broken filesystems, such as FAT32:

$ ./makelowercaserename.php \
  "/path/to/files" [--move-temp] >"/path/to/outbash.sh"

Or pass in an alternative command for mv via MVCMD:

$ MVCMD="git mv" \
  ./makelowercaserename.php \
  "/path/to/files" [--move-temp] >"/path/to/outbash.sh"

make-lowercase-rename's People

Contributors

magnetikonline avatar

Watchers

 avatar  avatar  avatar

Forkers

richo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.