How to process when theres a file in folder?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to process when theres a file in folder?
# 1  
Old 11-25-2013
How to process when theres a file in folder?

Hi All,

Seeking for your assistance regarding on how to process each file in the folder when there's a file.

Code:
 a/b -folder
File1.txt
File2.txt
File3.txt

Expected output:
If theres a file on the folder process it one by one by chmod to 755 and move it to specific folder.

Please Advise,

Thanks,
-nik
# 2  
Old 11-25-2013
Share your thoughts on solving this problem or show us what you tried so far. Let us know where you are stuck.
# 3  
Old 11-25-2013
Actually Sir Yoda i don't know how to start, i don't know what command that i'm going to used. sorry T_T

Thanks,
# 4  
Old 11-25-2013
You can use a for loop over a set of files in your directory. Then run chmod on each file and finally mv them to whatever directory you want.

There are several examples in this fora using for loop over a set of files or google it
# 5  
Old 11-25-2013
Your description of your problem is so cryptic that it is hard to guess what you want to do. As a very wild guess you could try something like:
Code:
for i in folder/*
do      if [ -f "$i" ]
        then    chmod 755 "$i"
                mv "$i" specific/
        fi
done

This User Gave Thanks to Don Cragun For This Post:
# 6  
Old 11-25-2013
Thanks Sir Don Cragun i have now an idea on how to solve my issue.

Thanks,
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitoring processes in parallel and process log file after process exits

I am writing a script to kick off a process to gather logs on multiple nodes in parallel using "&". These processes create individual log files. Which I would like to filter and convert in CSV format after they are complete. I am facing following issues: 1. Monitor all Processes parallelly.... (5 Replies)
Discussion started by: shunya
5 Replies

2. Shell Programming and Scripting

Bash to select oldest folder in directory automatically and log process

The `bash` below uses the oldest folder in the specified directory and logs it. The goes though an analysis process and creates a log. My problem is that if there are 3 folders in the directory folder1,folder2,folder3, the bash is using folder2 for the analysis eventhough folder1 is the oldest... (0 Replies)
Discussion started by: cmccabe
0 Replies

3. Shell Programming and Scripting

Checking Multiple File existance in a UNIX folder(Note: File names are all different)

HI Guys, I have some 8 files with different name and extensions. I need to check if they are present in a specific folder or not and also want that script to show me which all are not present. I can write if condition for each file but from a developer perspective , i feel that is not a good... (3 Replies)
Discussion started by: shankarpanda003
3 Replies

4. UNIX for Dummies Questions & Answers

Getting a process/program version from /proc folder

Hello I am writing a script that will first execute ps to get the list of processes running, and the go into the /proc folder for each PID listed and gather relevant information. I looked through the contents of a particular process in the /proc folder and I can't find where I can locate... (2 Replies)
Discussion started by: flagman5
2 Replies

5. Programming

how to copy downloaded file into my source file folder (putty/unix)

I need to "Ensure that when you download libchat.a from the VLE you have copied it to the same folder on ius as your source files. You then refer to the library (and the libraries it needs) with: gcc -o outputfile sourcefile.c -L. -lchat -lsocket -lnsl" But I have no idea what this means! (I... (2 Replies)
Discussion started by: fakuse
2 Replies

6. Shell Programming and Scripting

want to move set of file from one folder to another folder

Hi all, let me explain my requirments i am having 5 folder with different name for eg) abc , cdf , efd, rtg, ead each 5 folders contain 15 files i want to move 10 files to some other folder, remain 5 files should be there in the same folder. give me some suggestion on this. (6 Replies)
Discussion started by: natraj005
6 Replies

7. Shell Programming and Scripting

How to Process input files from folder in shell script?

Hi, I want to process all input files available into folder (C:\ShellPrg\InputFile\) Input files are abc.CSV , XYZ.zip (zip of CSV file), PQR.gz (zip of CSV file). I want to check the extension of file, If its .zip/.gz then need to unzip the file as .CSV I want to parse line by line of... (2 Replies)
Discussion started by: Poonamol
2 Replies

8. Shell Programming and Scripting

File Management: How do I move all JPGS in a folder structure to a single folder?

This is the file structure: DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies

9. Shell Programming and Scripting

Move the file from one folder to another folder

Hi, I have a requirement to move a file from one folder(a) to another folder(b) only when folder (b) have a write permission. Folder permission is 755 If the permission is otherthan 755 we need to come out of the loop I will appreciate your help Thanks Soll (1 Reply)
Discussion started by: sollins
1 Replies

10. Shell Programming and Scripting

Parse the .txt file for folder name and FTP to the corrsponding folder.

Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and... (3 Replies)
Discussion started by: MeganP
3 Replies
Login or Register to Ask a Question