Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 29, 2013, 02:04 PM   #1
Dogwalla
macrumors newbie
 
Join Date: Jan 2013
Extracting a file name from a folder...

I built two scripts that work quite well for me. The first one deletes the contents of folders within our company network and uploads a new file. The second script runs around the network and verifies the file uploaded properly.

The problem I'm having is this: I have to manually put in the file to be verified every time it runs.

The folder the source file lives in never changes, the file name changes before every upload, but there is only one file in the directory. What I'm wondering is if there is a little chunk of code I can use to just extract the file name of whatever is living in that folder so I use it in my verification script? It really sucks eggs to hop into the code and change it manually so it can run on a nighttime schedule.

I've tried everything I could find on similar examples, but I can't get anything to do what I need.

Thanks in advance.
Dogwalla is offline   0 Reply With Quote
Old Jan 29, 2013, 02:09 PM   #2
ConCat
Banned
 
Join Date: Jul 2012
Location: In an ethereal plane of existence.
I'll go ahead and assume you're using AppleScript. Here's the basic idea of how you'd do that:

Code:
tell application "Finder" to get files of folder (POSIX file "/Path/to/directory")
or you could use the old-style Mac OS directory structure

Code:
tell application "Finder" to get files of folder "Path:To:Directory"
Either one.
ConCat is offline   0 Reply With Quote
Old Jan 29, 2013, 02:26 PM   #3
Dogwalla
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
Holy cow...that worked perfect. Why does it seem that all the easy stuff ends up being the hardest?
Dogwalla is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
is there any way to recover a file when you replaced its folder? Raafael23 Mac OS X 10.7 Lion 4 Mar 3, 2013 11:13 PM
iPhone: Anonymous folder and file in Downloads folder bun.bhay Jailbreaks and iOS Hacks 4 Sep 26, 2012 08:41 PM
Mac locks folder when it opens a file in that folder Tommy Yesterday Mac OS X Server, Xserve, and Networking 2 Sep 25, 2012 03:40 PM
Extracting IPSW file georgelmoore Mac Basics and Help 0 Sep 6, 2012 12:49 PM
Encrpyt Folder/File Sangld68 iMac 3 Aug 31, 2012 03:41 PM

Forum Jump

All times are GMT -5. The time now is 11:14 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC