Create same file name to directory name without dropping it

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Create same file name to directory name without dropping it
# 1  
Old 11-07-2014
Create same file name to directory name without dropping it

Hi,

Under '/home' directory, there is one file called 'maddy'.Usually there used to be directories under /home directory.

Code:
 
[root@server06 home]# ls -alrt
total 132
drwx------  2 hcladmin sys       4096 May 30 10:54 admin
drwxr-xr-x 29 root     root      4096 Aug 27 03:54 ..
drwx------  2 v6admin  dba       4096 Oct 21 13:58 veeraadmin
drwx------  3 cmderoot cmderoot  4096 Oct 22 10:43 cmderoot
-rw-r-----  1 root     root     99314 Nov  7 06:59 maddy
drwxr-xr-x  5 v6admin  root      4096 Nov  7 06:59 .

How to change this file 'maddy' to directory without dropping it ?
Earlier 'maddy' file was directory not sure who has change it to a file now.How to find those informations?

Previously i was using this /home/maddy direcotory to move a files that exist in /oracle directory to /home/maddy since i do not have permission to move a file directly from /oracle to local drive (windows).

OS -- Linux 2.6

Regards,
Maddy

Last edited by Maddy123; 11-07-2014 at 01:24 AM..
# 2  
Old 11-07-2014
I dont think you can change a file to a directory of vice versa.
you can create a directory with name 'maddy' and move the file into that with the below code
Code:
mv maddy maddy_01 && mkdir maddy && mv maddy_01 maddy/maddy

This User Gave Thanks to SriniShoo For This Post:
# 3  
Old 11-07-2014
Please check if are able to open the file and it's content, if it looks familiar to you. Start basic investigation from there.
This User Gave Thanks to saps19 For This Post:
# 4  
Old 11-08-2014
Thanks Srini and Saps for your suggestions.

How to find out who has made those changes ?

Regards,
Maddy
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies

2. UNIX for Dummies Questions & Answers

How to create a TAR File in a Custom Destination Directory?

I want to create the tarzip file into a destination directory, i am in /var/sftp/home/archive/rquadri directory and i am using below command. However it is creating the file in the /var/sftp/home/archive/rquadri directory itself instead of /tmp, may i please know how do i resolve this. tar -cvzf... (5 Replies)
Discussion started by: Ariean
5 Replies

3. Shell Programming and Scripting

Create a flat file and directory structure

Hi All, is there any work around to generate the file and directory structure like below at left side at Output? and exclude all file except .abc .txt Current Directory structure |-------------files |---------------Share |-----------------dir1 |-----------------dir2... (11 Replies)
Discussion started by: heros
11 Replies

4. UNIX for Dummies Questions & Answers

Need help how to create a file (xml) list all files from directory

I have more than 10K songs in two directories on a hard drive. I would like to create a file list all of files name then change to .xml extension to upload to iPhone so I have a Karaoke list on my iPhone. I need your help to create a file by using command in Linux. Files names: 0001 More... (4 Replies)
Discussion started by: ggcc
4 Replies

5. Shell Programming and Scripting

How to create a log file that simply shows the name of a file and what directory it was moved to.

Newbie...Thank you for your help. I am creating my first script that simply generates subdirectories to organize video, music, and text files within those subdirectories from my current working directory. PROBLEM: I am trying to write a log file that contains, for each file, the original file... (0 Replies)
Discussion started by: BartleDoo
0 Replies

6. Shell Programming and Scripting

Read .txt file and dropping lines starting with #

Hi All, I have a .txt file with some contents as below: Hi How are you? # Fine and you? I want a script file which reads the .txt file and output the lines which does not start with #. Hi How are you? Help is highly appreciated. Please use code tags when posting data and... (5 Replies)
Discussion started by: bghosh
5 Replies

7. UNIX for Dummies Questions & Answers

create a file inside a directory

create a file inside a directory in one command like current directory is root i want to create a directory inside root and a file inside that directory is there any command like touch /d/d.txt d directory does not exist (1 Reply)
Discussion started by: abhisheklodha13
1 Replies

8. Shell Programming and Scripting

How to create a directory structure with getting input from a file.

Hi How to create a directory structure with getting input from a file. I have file in that following lines are written. ./activemq-4.1.2/activemq-core-4.1.2.jar ./activemq-4.1.2/backport-util-concurrent-2.1.jar ./camel-1.4.0/apache-camel-1.4.0.jar ./camel-1.4.0/lib/activation-1.1.jar... (12 Replies)
Discussion started by: itsjoy2u
12 Replies

9. Shell Programming and Scripting

Sed command dropping last record in File

Hello: I wrote a sed statement that is inserting 3 variables at the beginning of each record in a comma-delimited file: for FILE in *gnrc_lkup.csv do c=`echo $FILE | cut -c1-3` d=`grep $c $RTLIST | cut -c4-6` e=`grep $c $RTLIST | cut -c7` f=`grep $c $RTLIST | cut -c8` sed -e... (5 Replies)
Discussion started by: bheeke
5 Replies

10. Shell Programming and Scripting

Create file in each user directory

Hi, Im newbie, I wanna to create file in each user directory, how to make that script, maybe someone can give me example, im confusing coz i have to change form one user directory to other Thank U. (8 Replies)
Discussion started by: cleks
8 Replies
Login or Register to Ask a Question