Quote:
Originally Posted by Faye
Ach well it is similair like arizona said and could use that but it has spaces. If it is not possible thats not too bad then. About sloppy and first file i didnt care too much.
|
The meaning of what you have written is not clear because what you have written is somewhat incoherent. However if I am correct in my guess that you are attempting to convey that you are dealing with directories that contain spaces in their names, then a variant of the example I gave can be used.
The code I gave was a quick and dirty example intended to give you a starting point rather than a complete solution (which wasn't possible since your original post described a desire to do something that it ought to be obvious is impossible). It does not represent the limits of what can be done. Spaces in file and directory names can be handled in part by quoting variables and spaces in directory names can be also be handled by changing the way in which you build a list of directory names to iterate over. For example:
Code:
$ ls -d * | while read i;do echo "$i";done
That one still assumes that you have only directories in the current working directory and not files.
This example should deal both with spaces in file and directory names and with there being files in the current working directory
Code:
$ find . -maxdepth 1 -type d ! -name . | while read i;do cp "${i}/$(ls "$i" | head -1)" "${i}.jpg";done
Whether that does what you want or not will depend on what you want to do, which you have yet to properly explain.