Accessing a badly named directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Accessing a badly named directory
# 1  
Old 04-19-2012
Accessing a badly named directory

Someone in my group manages to name a directory -p. I'm not sure how they did it but it's there.

How can I access the directory or change it's name? I've tried to quote it (cd "-p"). I've tried to use the backslash (cd \-p) and a combination of the two (cd "\-p" and cd \-p). each of these attempts returns an error.

How can I get in or perform a name change?
# 2  
Old 04-19-2012
heh.

ok, got that out. most programs will take -- to mean end of options. you could also make it not start with a - by using relative path ./-p

Code:
cd -- -p
cd ./-p

This User Gave Thanks to neutronscott For This Post:
# 3  
Old 04-19-2012
Try:

Code:
cd -- -p

Code:
rmdir -- -p

# 4  
Old 04-19-2012
I hadn't even considered the ./-p approach. It worked great. Thanks for the quick response.

-- Scott
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find every directory named XYZ under the DVLP directory

I only want to find files under each branch of the directory tree inside directories named XYZ and there are multiple XYZ directories? (7 Replies)
Discussion started by: emc^24sho
7 Replies

2. Shell Programming and Scripting

perl Compare zone files in directory with what is listed in named.conf

I would really appreciate any assistance that I can get here. I am fairly new to perl. I am trying to rewrite my shell scripts to perl. Currently I have a shell script (using sed, awk, grep, etc) that gets a list of all of the zone files in a directory and then looks in named.conf for what... (0 Replies)
Discussion started by: brianjb
0 Replies

3. Shell Programming and Scripting

Move all files not in a directory into a subdirectory named for each given file

Hi Everyone! Looking for some help with a script that will take all files in any given root folder (which are not already in a folder) and put them into separate folders with the name of each given file. Any ideas? Thank you! (1 Reply)
Discussion started by: DanTheMan
1 Replies

4. Homework & Coursework Questions

C Program to search and read all named pipes in current directory

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a C program to search the current directory for all pipes. 1. It will print the pipe... (2 Replies)
Discussion started by: natwickley
2 Replies

5. Shell Programming and Scripting

[SSH] Accessing remote directory with user-passed path

Hi everybody, Currently, I have a script which access a remote computer via SSH, go to a folder already defined in the code and then executes a program in it, just like that: ssh user@host << EOI cd path ./file EOI It executes fine, but now I want to pass an argument in the command... (2 Replies)
Discussion started by: lgb3
2 Replies

6. Shell Programming and Scripting

Create a directory named as the current date

I am preparing a shell script to backup a few config files on a daily basis, with a retention of 30 days. Need some help with syntax/examples: The shell script (running as cron) would require the following: 1. create a sub-directory within a specified (backup) directory, in the format... (3 Replies)
Discussion started by: FeNiCrC_Neil
3 Replies

7. UNIX for Dummies Questions & Answers

how to find a file named vijay in a directory using find command

I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem. so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies

8. AIX

Problem accessing Oracle Directory on AIX

What are we doing ? 1) We ftp a PDF file to Oracle Directory which is on AIX server, using Business Object Server. The ftp account we use is prmtftdv. The oracle directory is owned by "oracle" account on aix. The default file permission is 640. 2) We are trying to read the PDF file using oracle... (1 Reply)
Discussion started by: ssatyaranga
1 Replies

9. Solaris

Accessing the home directory in shell script

How can I access home directory in a shell script. I am writing a script which will delete the log files in each of the user's directory Krishan (1 Reply)
Discussion started by: krishan
1 Replies

10. UNIX for Dummies Questions & Answers

create directory named current date

Since this site solved my problems before, I am back for more (solutions) I down load via a script every day a file that has the same name as the file of the day before. I want to move that file to its own directory like: /archive/jul30 How do I capture the systems date in a script an... (2 Replies)
Discussion started by: flowrats
2 Replies
Login or Register to Ask a Question