Computing.Net > Forums > Office Software > How to Move Directory With Spaces In Between?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

How to Move Directory With Spaces In Between?

Reply to Message Icon

Name: Sujan (by Sujan Banerjee)
Date: July 20, 2009 at 23:57:18 Pacific
OS: Solaris 5.8
CPU/Ram: 2GB
Product: Sun sparc / Sparc 9
Subcategory: General
Comment:

Hi,
I am facing a problem which is Driving me Nuts.
Here we are given Patches/Hotfixes which are Developed by Developers on Windows, which we Load
on Solaris using SecureFTP or some other Tool.
The Nomenclature that they follow is Like this:-
"DD-MON-YYYY v AA.BB" where AA=Version and
BB=Patch Number. As you might have noticed, On Either Side of "v" there is a space.
So the directories are something like this:-
[root@bsnlom01 patches]# ls -1|sort -t\. -n -k2,2|grep -v BACKUP|head -10|tail -9
09-Mar-2009 v 0.1
10-Mar-2009 v 0.2
16-Mar-2009 v 0.3
19-Mar-2009 v 0.4
26-Mar-2009 v 0.5
27-Mar-2009 v 0.6
30-Mar-2009 v 0.7
31-Mar-2009 v 0.8
01-Apr-2009 v 0.9

Note all these are Directories. There are 153 Such Directories and Still Counting. I want to MOVE all these Old Directories to an Archive Directory, but unable to do so because of Space In Directory Name.
I tried following:-
----------------------------------------------------------
ls -1|sort -t\. -n -k2,2|grep -v BACKUP|while read line
do
mv -i $line WOM_Hotfixes;
done
--------------------------------------------------------
But its failing as it is trying to read all three sections as separate directories.

Please help me out with this Issue.
Thanks In Advance,
Regards,
Sujan



Sponsored Link
Ads by Google

Response Number 1
Name: Sujan (by Sujan Banerjee)
Date: July 21, 2009 at 00:07:01 Pacific
Reply:

Hi Friends,

I got the solution, but thought will Post here for others.
Simply Quote the String with Double Inverted Commas("").
As simple as that. :-)
So script would be:-
----------------------------------------------------------------------------
ls -1|sort -t\. -n -k2,2|grep -v BACKUP|grep -v WOM|while read line
do
mv -i "$line" WOM_Hotfixes
done
----------------------------------------------------------------------
And Bingo, all those files are moved to Archive Dir "WOM_Hotfixes".

Cheers :-)
Sujan


0
Reply to Message Icon

Related Posts

See More


Software to remotelly uni... Print button in Excel



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: How to Move Directory With Spaces In Between?

How to combine Time and Text in exc www.computing.net/answers/office/how-to-combine-time-and-text-in-exc/8387.html

How to double space in word perf 12 www.computing.net/answers/office/how-to-double-space-in-word-perf-12/5867.html

how to us crytal report 10 in vb6 program www.computing.net/answers/office/how-to-us-crytal-report-10-in-vb6-program/9422.html