Re: Bash Help: Renaming all files in a Directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thom Paine wrote:
> I'm making a digital picture frame out of an old laptop and the pic
> viewer doesn't support filenames with spaces in them.
> 
> Is there a quick command I can type to process all files in a
> directory that will rename the files from "Family Pic 001.jpg" to
> "FamilyPic001.jpg"?

A little while loop would be one way to do this:

ls "Family Pic"*.jpg | while read i; do mv "$i" $(echo $i | tr " " _)

- -- 
Todd        OpenPGP -> KeyID: 0xD654075A | URL: www.pobox.com/~tmz/pgp
======================================================================
Ah!  Useless!  Every one of you!  Fine.  I will defend myself and to
hell with all of you!
    -- Stewie Griffin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)
Comment: When crypto is outlawed bayl bhgynjf jvyy unir cevinpl.

iG0EARECAC0FAkTBaRMmGGh0dHA6Ly93d3cucG9ib3guY29tL350bXovcGdwL3Rt
ei5hc2MACgkQuv+09NZUB1rAGACdFsuwRuW6+HFH00QwVEYgwYEC05EAn060zwue
pTsH6qsWsKEpET5OS6hV
=M4yq
-----END PGP SIGNATURE-----


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux