LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-10-2009, 11:43 AM   #16
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49

when i typed n to that line, it said Missing }.

that echo $0 prompted me for the same responses. when i typed n, it said -tcsh
 
Old 09-10-2009, 11:44 AM   #17
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
find . -name '* *'.[jJ][pP][gG] | while read file; do echo mv "$file" "${file// /}"; done


that what was i tried to run, FYI
 
Old 09-10-2009, 11:52 AM   #18
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Right, that's what I feared, csh variants are completely different animals. Unfortunately I am not proficient with csh, and I am really no interested in learning it. I suggest you to install bash and run my command in bash. None of the snippets posted in this thread (by me and the others) will work in any csh variant, I think.
 
Old 09-10-2009, 11:52 AM   #19
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Could it be that i have bash but i'm just not in it? how could i tell or try switching over to it?
 
Old 09-10-2009, 11:54 AM   #20
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
or should i do a su - and try it maybe?
 
Old 09-10-2009, 11:55 AM   #21
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
If you have it installed just running it should work

Code:
bash
Then echo $0 should report "bash" instead of "tcsh". And my command should work inside that new shell. To go back to tcsh you can type "exit". By the way, did you install tcsh voluntarily or did it come by default in your distribution? Most distros nowadays ship either bash as the default shell (and maybe busybox's ash for init, which is lighter).
 
Old 09-10-2009, 11:56 AM   #22
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by rjo98 View Post
or should i do a su - and try it maybe?
No, never run massive commands like this as root. You shouldn't operate as root. Only for administrative tasks.
 
Old 09-10-2009, 12:00 PM   #23
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
OK, I typed bash then echo $0 and it told me bash!!!

so now i ran the command and a TON of stuff flew by on the screen, the last line being

mv ./06-13-2009/gus/gus new9.jpg ./06-13-2009/gus/gusnew9.jpg


so i guess I should be good to remove the echo right?
 
Old 09-10-2009, 12:02 PM   #24
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
So it seems. If you want to be really safe, you could backup the whole directory before running it.
 
Old 09-10-2009, 12:04 PM   #25
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
would this be a tar.gz i would be making?

does it show i'm very new to Linux :-)
 
Old 09-10-2009, 12:07 PM   #26
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by rjo98 View Post
would this be a tar.gz i would be making?
Whatever suits you, you can use tar or even cp. For example:

Code:
tar cf backup.tar orig_dir/
# or
cp -R orig_dir/ dist_dir
I didn't enable compression because most images surely will already be compressed, so you are going to gain very little from compression and it will take much longer to do the backup if the directory is big. Once you have checked that the renaming went ok you can delete the backup.

Quote:
does it show i'm very new to Linux :-)
We all were at some point
 
Old 09-10-2009, 12:25 PM   #27
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Thanks for all the help man. hopefully i can take it from here, hopefully :-)
 
Old 09-10-2009, 12:50 PM   #28
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Found a small problem. I get a "no such file or directory" error when it tries to remove the spaces from folder names. is there a way to make it do only the files and not folder names as well?
 
Old 09-10-2009, 12:57 PM   #29
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Using -type f should solve that, in the find part. I changed the examples above (well, in the previous page by now) to reflect that.
 
Old 09-10-2009, 01:00 PM   #30
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
ok, so it should have -type f in between the . and the -name, as shown below. i'll give it a shot

find . -type f -name '* *'.[jJ][pP][gG] | while read file; do echo mv "$file" "${file// /}"; done
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
remove xtra spaces lipun4u Linux - Newbie 2 09-16-2008 01:56 AM
remove all spaces from a line in C xeon123 Programming 12 10-23-2007 01:29 AM
How to remove spaces from a string pawan_songara Programming 14 08-30-2006 09:20 PM
how to find the spaces on the folder??? ashley75 Linux - General 4 04-10-2006 03:56 PM
Is it possible to remove spaces Alex_jacobson Linux - General 4 01-16-2005 10:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration