On Mon, Oct 13, 2003 at 07:26:39AM -0700, Dirk Ouellette wrote: > I've tried mv with this error message and the --help still confuses me; > > MUSIC]# mv /data2/MUSIC/*.php /data2/MUSIC/SoKalmery*.mp3 > mv: when moving multiple files, last argument must be a directory > Try `mv --help' for more information. > [EMAIL PROTECTED] MUSIC]# mv *.php /data2/MUSIC/*.mp3 > mv: when moving multiple files, last argument must be a directory > Try `mv --help' for more information
In windows this works, but not with unix because of some subtleties. It is the shell and not the mv program that interprets the asterisks. In win/dos the shell is command.com or cmd.exe. The 'move' command gets a file mask *.php and recognizes that it needs to treat it as a wild card. In unix, you are probably using bash as a shell. The asterisks are translated before it is passed to the mv command. In dos move sees two arguments "*.php" and "*.mp3". In unix mv sees as many arguments as there are files. Say you have a.php, b.php, c.php and alpha.mp3. $ mv *.php *.mp3 gives mv these arguments: a.php b.php c.php alpha.mp3 If there are only a.php, b.php and c.php, mv sees: a.php b.php c.php *.mp3 Use the rename command which is usually distribution specific. On some distros it is a C binary. On others it is a perl script (debian). Or do it yourself (however this won't work if there is a file with a space in the name): for i in *.php ; do mv `basename $i .php` $i.mp3 ; done Cory -- Cory Petkovsek Adapting Information Adaptable IT Consulting Technology to your (541) 914-8417 business [EMAIL PROTECTED] www.AdaptableIT.com _______________________________________________ EuG-LUG mailing list [EMAIL PROTECTED] http://mailman.efn.org/cgi-bin/listinfo/eug-lug
