LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-01-2003, 06:34 PM   #1
nightjar
Member
 
Registered: May 2002
Location: Argentina
Distribution: Mandrake 9.2
Posts: 177

Rep: Reputation: 30
Wink renaming and moving filenames


I have a lot of files with these names (windows format)

html\dir\anotherdir\name1.php
html\dir\anotherdir\anothername.php
etc

and so on

Can anyone learn me how to change the name and move the file to

/html/dir/anotherdir/name1.php
etc

Note that I must remove the first part of the name and move it to the new dir

Thanks in advance !!!
 
Old 03-01-2003, 06:38 PM   #2
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
How can you have directories in Linux with backslashes? Its not possible. Do you mean you have text files that have these paths in them?
 
Old 03-01-2003, 06:46 PM   #3
nightjar
Member
 
Registered: May 2002
Location: Argentina
Distribution: Mandrake 9.2
Posts: 177

Original Poster
Rep: Reputation: 30
The NAME of the files have backslashes because it was untarred from a compress file and have those names

The names are:
html\aaa\vvv\ccc\rrrr.php
html\aaa\vvv\ccc\ssss.php

They're not in these dir

Tnx

 
Old 03-01-2003, 06:51 PM   #4
crichards
Member
 
Registered: Feb 2003
Location: Arizona
Distribution: Gentoo!
Posts: 124

Rep: Reputation: 15
Here's how you'll move them...

mv -- "file\name.php" /where/you/want/your/file.php

EDIT: But I don't see how it would happen. I don't see how it COULD happen.

Last edited by crichards; 03-01-2003 at 07:01 PM.
 
Old 03-01-2003, 06:52 PM   #5
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Oh so you zipped up the files on your windows machine and unzipped them on your Linux machine? I stand corrected then. I guess you can have backslashes for directories in linux.

I would just suggest creating the directories over again and then copying the files into the new directories:

mkdir html
cd html
mkdir aaa
cd aaa
mkdir vvv
cd vvv
mkdir ccc
cd ccc

cp \html\aaa\vvv\ccc\rrrr.php /html/aaa/vvv/ccc

How about this?
 
Old 03-01-2003, 07:26 PM   #6
nightjar
Member
 
Registered: May 2002
Location: Argentina
Distribution: Mandrake 9.2
Posts: 177

Original Poster
Rep: Reputation: 30
may be
but it don't resolve the problem
Now I have for example:

/var/www/html/foodir/html\aaa\bbb\ccc\name1.php
The only thing that I do was change the dir but I need to supress the firs part of the name (aaa\bbb\ccc)
It's clear
Sorry for my english
 
Old 03-01-2003, 07:36 PM   #7
JimKyle
Member
 
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 16.04 LTS
Posts: 214
Blog Entries: 1

Rep: Reputation: 39
Try this:
mv -p "html\aaa\bbb\ccc\name1.php" /var/www/html/foodir/name1.php

Note that the entire bad filename is quoted, since Linux will interpret the backslash as an escape, and the filename itself gets repeated in the target string. The -p argument tells mv to create all intermediate directories if they don't already exist.

If the quoting doesn't work, try doubling up the backslashes, because the string "\\" stands for one real "\" in most applications...

Last edited by JimKyle; 03-01-2003 at 07:38 PM.
 
Old 03-01-2003, 08:26 PM   #8
nightjar
Member
 
Registered: May 2002
Location: Argentina
Distribution: Mandrake 9.2
Posts: 177

Original Poster
Rep: Reputation: 30
mv -p?

# bash mv:invalid option


I'm with ML 9.0 and the option -p don't exist

In the other hand without -p can't handle the backslashes and assume the name as

htmlaaabbbcccname1.php
 
Old 03-01-2003, 08:32 PM   #9
nightjar
Member
 
Registered: May 2002
Location: Argentina
Distribution: Mandrake 9.2
Posts: 177

Original Poster
Rep: Reputation: 30
I forgot that with double backslashes \\ the name don't change
 
Old 03-01-2003, 08:41 PM   #10
JimKyle
Member
 
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 16.04 LTS
Posts: 214
Blog Entries: 1

Rep: Reputation: 39
My bad... The -p option comes from mkdir, not from mv!

Try just "mv html\\aaa\\bbb\\ccc\\name1.php name1.php" first.

If that succeeds in getting the front part of the name chopped off, then you should be able to use mv again to put it in any directory you want even if you have to manually create all the subdirectories first.
 
Old 03-01-2003, 09:30 PM   #11
nightjar
Member
 
Registered: May 2002
Location: Argentina
Distribution: Mandrake 9.2
Posts: 177

Original Poster
Rep: Reputation: 30
Well
I find the solution in freshmeat
I found GPrename and all work fine !!!

Tnx at all who help me !!!
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Renaming Folders Tr@ce Linux - Newbie 1 02-19-2005 02:08 PM
renaming a file?? U-Toast Linux - Newbie 2 08-29-2004 01:07 AM
copying/moving stalls when moving a lot of data to a usb stick =X¥®µ§= Linux - Hardware 10 07-30-2004 05:29 AM
Need help with renaming jpgs joe_stevensen Programming 2 06-26-2004 04:29 AM
renaming to lowercase locazor Linux - Software 1 01-02-2004 08:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:28 AM.

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