Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #5920
| Path | csiph.com!news.swapon.de!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail |
|---|---|
| From | Jacob Sparre Andersen <sparre@nbi.dk> |
| Newsgroups | comp.programming |
| Subject | Re: help with batch code to create subfolders inside each folder of a directory and then copy parent folder contents to subfolder |
| Date | Fri, 16 Oct 2015 09:31:03 +0200 |
| Organization | JSA Research & Innovation |
| Lines | 29 |
| Message-ID | <8737xbtglk.fsf@adaheads.sparre-andersen.dk> (permalink) |
| References | <877bca17-7c4c-4538-9aa5-d6fc0b2201ad@googlegroups.com> |
| NNTP-Posting-Host | 109.59.56.171.mobile.3.dk |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | loke.gir.dk 1444980664 15023 109.59.56.171 (16 Oct 2015 07:31:04 GMT) |
| X-Complaints-To | news@jacob-sparre.dk |
| NNTP-Posting-Date | Fri, 16 Oct 2015 07:31:04 +0000 (UTC) |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
| Cancel-Lock | sha1:6brWExLWz06OwCZrhtUvS7OGqiU= |
| Xref | csiph.com comp.programming:5920 |
Show key headers only | View raw
oltre0cean0 <imofloripa@gmail.com> writes:
> Please, I need some help... I have a folder with around 6000
> subfolders with images inside them, each subfolder has a different
> number of images, and some of them have 0 images also. now i need to
> create another 2 subfolders inside each subfolder, naming these new
> subfolders with the names "medium" and "thumbs" and copy inside these
> subfolders the images that are present in the parent folder. Example:
> lets say i have a folder named 1000 with 10 images inside it, named
> 1.jpg, 2.jpg, 3.jpg etc until 10.jpg. I need to create a folder named
> "medium" and a folder named "thumbs" inside the folder named 1000, and
> copy the images that are present in the folder 1000 to both new
> subfolders "1000/medium" and "1000/thumbs".
In Bash you can do it like this (assuming that all the image files end
in ".jpg"):
for folder in * ; do
for subfolder in medium thumbs ; do
mkdir "${folder}/${subfolder}"
cp -p "${folder}"/*.jpg "${folder}/${subfolder}/"
done
done
Greetings,
Jacob
--
PNG: Pretty Nice Graphics
Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread
help with batch code to create subfolders inside each folder of a directory and then copy parent folder contents to subfolder oltre0cean0 <imofloripa@gmail.com> - 2015-10-15 12:59 -0700 Re: help with batch code to create subfolders inside each folder of a directory and then copy parent folder contents to subfolder Jacob Sparre Andersen <sparre@nbi.dk> - 2015-10-16 09:31 +0200
csiph-web