Script help: Finding Files on a server with no DB reference


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script help: Finding Files on a server with no DB reference
# 1  
Old 04-26-2012
Script help: Finding Files on a server with no DB reference

Hey Everyone,

This is my first post here so I hope I'm in the right spot. I need some help with a script. I don't have much experience in UNIX besides the basic command line stuff which I haven't used much so bear with me. Smilie

I've got a web application which acts as a document repository with an Oracle database and mostly pdf documents stored on the file system of a UNIX server. Each document is supposed to have a reference in the database with it's full path. Over the years people have been playing around in the file system and moving/deleting documents. We are running out of space and we need to do a massive clean up and re-org to get rid of orphaned documents.

I'm looking to write a script that will look at all the files in the file system and check against the database to see if there is a reference or not. If the file is not referenced in the database I'd like to list it in a file so we can analyze if the file should be deleted or moved back to it's proper place.

I have access to the file system via FTP and the DB with SQL Developer. I was thinking of writing a script to list all the files in the file system and then use that in SQL Developer somehow to search against the DB but I'm wondering it isn't possible to do it all in one big bang and not have to run two seperate scripts/processes.

Again, any help is more than welcome and thanks for taking the time to read this.

Thanks!
# 2  
Old 04-26-2012
You need to get at least one single list. Either from the UNIX box or from the db.

So, what UNIX OS (the file server) do you have. Can you connect to the UNIX box as a user? If so, show the output of:
Code:
uname -a

# 3  
Old 04-27-2012
Quote:
Originally Posted by jim mcnamara
You need to get at least one single list. Either from the UNIX box or from the db.

So, what UNIX OS (the file server) do you have. Can you connect to the UNIX box as a user? If so, show the output of:
Code:
uname -a

Hi jim, thanks for taking the time. Here is the result.

Code:
SunOS 5.9 Generic_122300-54 sun4u sparc SUNW,Sun-Fire-480R


Last edited by methyl; 05-01-2012 at 07:11 PM..
# 4  
Old 05-01-2012
A shell script on the *nix server can both read the file system and use SQL*Plus to access the Oracle database.
# 5  
Old 05-01-2012
can you provide an idea of how many document files still exist on the filesystem, and how many rows are in the database? This may help with selecting the most efficient solution.
# 6  
Old 05-10-2012
Quote:
Originally Posted by Yeaboem
can you provide an idea of how many document files still exist on the filesystem, and how many rows are in the database? This may help with selecting the most efficient solution.
There are app. 250K records and 9GB of files. I'm not sure of the exact number to be honest.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding total distinct count from multiple csv files through UNIX script

Hi All , I have multiple pipe delimited csv files are present in a directory.I need to find out distinct count on a column on those files and need the total distinct count on all files. We can't merge all the files here as file size are huge in millions.I have tried in below way for each... (9 Replies)
Discussion started by: STCET22
9 Replies

2. Shell Programming and Scripting

Need help in finding and copying list of files using bash shell script

Dear All, I have a situation where I want to copy some files of type .txt. These files are o/p from one program. Some of the files are named as fileName .txt instead of fileName.txt after fileName by mistake I have specified "space". Now I want to move these files as follows. mv fileName*... (13 Replies)
Discussion started by: linuxUser_
13 Replies

3. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

4. Shell Programming and Scripting

Help with shell script - not finding files

Hello, I have a shell script like the one below but cannot get it working: #!/bin/bash #$ -cwd CHR=$2 # directories ROOT_DIR=./ RESULTS_DIR=${ROOT_DIR}results/ # executable SHAPEIT_EXEC=${ROOT_DIR}shapeit.v2.r727.linux.x64/shapeit.v2.r727.linux.x64 # parameters THREAT=5... (1 Reply)
Discussion started by: wmelroy
1 Replies

5. Shell Programming and Scripting

script for to take files from FTP server to UNIX server and Unzipped that files

script for to take files from FTP server to UNIX server and Unzipped that files (1 Reply)
Discussion started by: sunilamarnadh
1 Replies

6. Shell Programming and Scripting

Finding all script files

Hello All, After a HDD crash, I would like to selectively back up all my script files. What is the most efficient way to do this? The pseudo code I was thinking of was something like this: for a in `find ./ -name "*"` do if (file $a) == Bourne|Tcsh|... then echo $a >>... (7 Replies)
Discussion started by: pru
7 Replies

7. Shell Programming and Scripting

Need help in writing script for finding files in the unix machine?

I would like to find whether a file exists in the UNIX machine. That i can check using if ;then echo "exists" echo " `cat $file` " else echo "invalid file" fi. and i can find out using : find / -name "filename" . But it i have wanted to search in all directories. How to get... (3 Replies)
Discussion started by: rparsa001
3 Replies

8. UNIX for Dummies Questions & Answers

Unix shell script for finding top ten files of maximum size

I need to write a Unix shell script which will list top 10 files in a directory tree on basis of size. i.e. first file should be the biggest in the whole directory and all its sub directories. Please suggest any ideas (10 Replies)
Discussion started by: abhilashnair
10 Replies

9. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

10. UNIX for Dummies Questions & Answers

Reference a directory on another Unix server

I want to reference a directory on another Unix server. I have looked at the ln command but have seen information only relating to directories on the same server. Any suggestions? It is IBM AIX Unix 4.3 server. (1 Reply)
Discussion started by: pengwyn
1 Replies
Login or Register to Ask a Question