Accessing Folders with random name - help =(
Hello All,
I am doing some parallel computing and running i.e. 100 jobs into 100 different processors. each job is producing some random folder and putting all the output files in there. now, I need to know how can i access those random folders using java. people have been recommending AbsolutePath , use of start,etc etc, but its not working.
Thanks for your help.
p.s. folders names are numbers in ascending order i.e. and each folder contains the same files ( file1.csv file2.csv )
201032434/file1.csv
201035474/file1.csv
201042328/file1.csv
and so on..
the problem is i need to access these directories but
they have random number !! so i can't really specify
the directory and get into it...Well, they have to be stored in some specified parent directory.
Just call File.listFiles() from that parent directory and access the "random" directories.
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
Similar Messages
-
Hi,
i have a document library Named "Digital" in a site collection. In that document library i have bunch of customer folders with different customer name. My requirement is i need to create three sub-folders (like Images, Processed, Status) each of
customer folders. so how can i automate to create sub-folders with specific name. can i use object model or power shell to achieve this one.
Thanks in advanced!Hi Murugesa,
Thanks for your help. i was trying to create folder inside document library using your code. but unfortunately i cant debug code and cannot create folder inside customers folder. Following is the code, basically i am creating a SharePoint project and adding
an item as class file and deploying to share point site and then trying to debugging code, but break-point showing as yellow circle. i checked solution has been deployed to the server but still not creating any folder. It will be very helpful if you can describe
all the steps. should i create console application?
Appreciated !!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace Add_Sub_Folders
class Create_Folders
public void Sub_Folders()
var foldersList = new List<string>();
SPSecurity.RunWithElevatedPrivileges(delegate()
try
using (var site = new SPSite(SPContext.Current.Site.Url.ToString()))
using (var web = site.OpenWeb())
web.AllowUnsafeUpdates = true;
foreach (SPFolder folder in web.GetFolder("http://nyc01d1sptmp01:8080/Shared%20Documents/").SubFolders)
if (folder.Url.ToString() != "Shared Documents/Forms" && folder.Url.ToString() != "Shared Documents")
foldersList.Add(folder.Url);
SPFolder subFolder = web.GetFolder(folder.Url);
subFolder.SubFolders.Add("Draft");
subFolder.SubFolders.Add("Status");
subFolder.SubFolders.Add("Final");
folder.Update();
web.AllowUnsafeUpdates = false;
catch (Exception ex)
ex.Message.ToString(); -
Automator action with dropdown to make folders with predetermined names
Is there an action/workflow that will allow me to create Folders using a dropdown menu of predetermined names for those folders?
I haven't seen one, and since no one has posted about one yet, I'll throw this out.
I modified a couple of handlers I have laying around into a Run AppleScript action that will make folders from a list of names. The list can be set in a Get Specified Text action, with the "menu" being a Choose from List action:
Tested workflow:
1) Get Specified Text (your folder names, separated by returns) for example:
Testing
Another test
My Spiffy New Folder
2) Filter Paragraphs (Return paragraphs that are not empty)
3) Choose from List (Prompt: Please choose folder names:)
4) Run AppleScript:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into an Automator 'Run AppleScript' action">
on run {input, parameters}
make folders with names from a list
input: a list of names (text items)
output: a list of Finder items (aliases) created
set output to {}
set DestinationFolder to missing value -- set the destination path here if desired
try -- verify that the path is valid
set DestinationFolder to DestinationFolder as alias
on error
set DestinationFolder to (choose folder with prompt "Choose the location to make the selected folders:")
end try
repeat with AnItem in the input
GetUniqueName for AnItem from DestinationFolder -- avoid duplicates
try
tell application "Finder" to make new folder at DestinationFolder with properties {name:the result}
set the end of the output to the result as alias
end try
end repeat
return output
end run
to GetUniqueName for SomeName from SomeFolder
check if SomeName exists in SomeFolder, creating a new unique name if needed
parameters - SomeName [text]: a name.extension to check for
SomeFolder [mixed]: a folder to check
returns [text]: a unique name
set {Counter, Divider} to {"00", "_"}
set Here to -(offset of "." in ((reverse of text items of SomeName) as text)) - 1
set TheName to text 1 thru Here of SomeName
if Here is -1 then -- no extension
set TheExtension to ""
else
set TheExtension to text (Here + 1) thru -1 of SomeName
end if
set NewName to TheName & TheExtension
tell application "System Events" to tell (get name of items of folder (SomeFolder as text))
repeat while it contains NewName
set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
set NewName to TheName & Divider & Counter & TheExtension
end repeat
end tell
return NewName
end GetUniqueName</pre>
- the output from the Run AppleScript action is a list of aliases to the folders created, if you want that information to do something with. -
Window 8.1 Merging Files with from Folders With Same Name Together
I notice folders with the same exact name in the same location will merge together all the files into one folder without any notice to change the name. Is there some way to change this setting?
If set to show folder-merge conflicts, you should get a conflict-warning dialog.
Control Panel > Folder Options > View tab
Clear the check box below.
-Jerry -
Newbee: How to access fields with duplicated names?
How can i access fields where the name already exists (Like FieldName[0], FieldName[2],...) - and where else can i get answers to simple questions like this one?
Fieldname[n].thisValue does not work.
Thanks for help.xfa.resolveNode("FieldName["0"]") etc.. I think should work
-
Save to folders with hyphenated names
Acrobat Pro 9.0 cannot save to folders that contain apostrophes, hyphens or other special
characters. This is such a step backwards and is so PC oriented for a product that was originally created for the Mac and was streets ahead of the PC equivalents.
Abobe's comment is: Unfortunately this is a product limitation that we cannot resolve.
Why then can every other application that I use on my Mac save to folders with these characters?Hi alexdon.
What do you want a screenshot of? A view of the internal memory or SD card showing the odd folder name? Or a shot of the contents of the folder showing just a .nomedia file?
As I am wondering if the long folder name is some sort of key, until I know what they are, I am a little uneasy about quoting the full folder name but (replacing the last four characters with asterisks) one of the folders on the internal memory is called.
.HhTjqSRo6dybqDAV2ImUSRE****= -
Unable to access folders with RV082 QuickVPN
I have an office peer-to-peer network (win 7) connected with a QNAP NAS and a RV082 router. There is no proper naming (I don't know how to implement it) so everything is access via IP.
I managed to configure my RV082 to accept VPN connection from home via QuickVPN with cert etc and managed to ping all the running devices in the office, i.e. printers, nas, etc after connected with the office network.
However, when I try to browse the NAS say run "\\192.168.1.5\", it says "The network path was not found". But I could ping the IP just fine but not the name, I'm not sure if adding it into my lmhost will help.
I'm wondering if any of these has anything to do with my VPN settings? or is it my horrible network setup that is giving me the trouble. I also noticed that if i'm not on the same workgroup, when I try to browse office workgroup from Explorer/ Entire Network it will say "workgroup not accessible. You might not have permission to use this network resource..................."
Is this more of a Windows than my VPN issue? do I need other protocols besides TCP/IP such as NWlink netbios. I only have client for microsoft network, file sharing and tcp/ip running.Hi Yee,
Thank you for posting. Are you able to access shares on \\192.168.1.5 locally? If you can access the shares when you are onsite you should be able to access them using QuickVPN as well. You are correct that if you add the hostnames to the LMHosts file you will be able to access by name.
This sounds like an issue with the NAS itself. You can check this by trying to access a shared folder on a PC. You may need to disable any antivirus or firewall software on that PC before you can access shared folders.
Please keep us updated. -
Access website with same name as internal dns...
Hi there
I've set up a server with internal dns zone as 'example.com' with the machine name being 'server.example.com'
Everything has been going well, but we cannot now access our externally hosted website at 'www.example.com' I now realise from looking at other posts on the web that perhaps I should have not used the same dns address internally as is used externally, but we have plans to bring mail servers in-house and so thought that this would be the correct way to go.
Can anyone offer advice on the correct way to resolve this?
ThanksFrom what you're saying then, I need to change the DNS host name of the internal network to example.net or similar.
You can use a level within your own domain, such as server.internal.example.com, where server is the host name and internal identifies a host within your network, and example.com is a domain you own. Larger networks use this construct to identify hosts within a corporate site or a particular building, such as www.corp.example.com, www.frobnitz.example.com and www.boston.example.com.
I assume it doesn't matter if I don't own the domain example.net?
Do not use a domain that you do not have permission to use.
Only use domains you own (best), or domains that will never be activate.
It's best if you use a domain you own or a subdomain of a domain you own, or (less desirably, but functional) use a Top Level Domain (TLD) string that will never be a domain (a completely made-up domain such as server.tvkiddomain where tvkitdomain is a text string that will never match a real domain such as .COM or .NET or .BIZ or .TRAVEL or the country codes or the gazillions of these TLD strings that are coming on-line. (That there are TLDs coming on-line makes this somewhat more risky; you can end up using a domain you don't own of somebody lights up a matching TLD.)
The second parallel domain is small cost and simple, particularly as you need few or no services for it from your registrar. (When I buy domains for a site, I usually purchase several TLDs around the domain -- such as the classic big three .COM, .NET and .ORG -- and then have these available for just this sort of purpose. It's easier to buy these up front than to add them later, given the usual domain squatting that can happen. And it's not much money. And it's flexibility for later network activities, and far easier to describe and to support.)
Will the changeip command change the DNS name of machines that I've set up, so that server.example.com will be renamed server.example.net? I assume I'll need to unbind and rebind any client machines that I've bound to the server?
changeip would be the tool I'd use, yes. And I'd reconnect, yes. There's a DNS command around that flushes the DNS caches on the clients; you'll also need to clear that.
Prior to Leopard, on each DNS client:
sudo lookupd -flushcache
Leopard DNS cache flush, on each DNS client:
sudo dscacheutil -flushcache
Thanks for the pointer to the other post, was helpful, but I think that changing the internal DNS host name will be the simplest option...
IMO, the simplest option is to avoid domain name collisions and to avoid domains you don't own; to maintain the basic operations and assumptions of DNS.
Bad DNS is one of the few things you can do that can screw up other hosts and other sites on the Internet. -
Apple script to replace content in specific folders with folder names in csv
Can anyone please help me with this scenario... It would greatly be appreciated!
1. I have a list in csv containing 3 columns: Column 1 = Folder name • Column 2 = Entry A • Column 3 = Entry B
2. I have 100 folders named the same as Column 1. in each folder there is different files.
This is what I need.
I need the script to to find the folder based upon column 1.
Then the script should search for place holder named "Entry A" and replace it's contents with data from Column 2. There are several files with in the folder that contain place holder "Entry A" so it should replace it all but must remain with in that folder.
Then same for column 3 find place holder named Entry B and replace.
Then it should save all files.
Any help is greatly appreciated! Thank you!Can anyone please help me with this scenario... It would greatly be appreciated!
1. I have a list in csv containing 3 columns: Column 1 = Folder name • Column 2 = Entry A • Column 3 = Entry B
2. I have 100 folders named the same as Column 1. in each folder there is different files.
This is what I need.
I need the script to to find the folder based upon column 1.
Then the script should search for place holder named "Entry A" and replace it's contents with data from Column 2. There are several files with in the folder that contain place holder "Entry A" so it should replace it all but must remain with in that folder.
Then same for column 3 find place holder named Entry B and replace.
Then it should save all files.
Any help is greatly appreciated! Thank you! -
Rename files with random names
Hi all -
I have a folder of 600 images to go on a digital photo frame. The digital photo frame always plays in the same order, so I want to randomize the files before I put them on the frame.
I tried using automator's batch rename, but that won't randomize the files.
Anyone know of a software utility to do this easily? I am unfamilar with scripting, so any solutions i've found online that use scripting are foreign to me..
TIAok, paste the following into script editor and save it as an application.
tell application "Finder"
set fol1 to folder "1" of (path to desktop)
set fol2 to folder "2" of (path to desktop)
set theNum to number of items in fol1
repeat with i from 1 to theNum
set this_item to some item of fol1
set fname to name of this_item
set name of this_item to (i as text) & fname
set x to (first item of fol1 whose name is (i as text) & fname)
move x to fol2
end repeat
end tell
This will work as follows. Say you have folder on the desktop named 1 with 600 images.
make a folder named 2 on the desktop and run the script. It will move your images from folder 1 to folder 2 and add a random number between 1 and 600 to the front of their names. The script can be easily adjusted to work on other folders but since you don't know apple script I suggest you create folders 1 and 2 on your desktop, move all your images to folder 1 and run the script. You can run the script by pressing the "run" button in script editor or by double-clicking on the saved application.
Message was edited by: V.K. -
I cannot access certain seemingly random sites, help appreciated
Hello,
I am having trouble accessing certain sites on my macbook pro 15" retina display. I am running OS X Mavericks 10.9.
For now the websites that I am having trouble accessing are hotmail.com, which is annoying, and clamxav.com, which is random. The websites themselves are not down, I have checked.
This is now a browser issue, I have checked on firefox and safari and chrome.
I have cleared all data on all browsers, this is not the issue.
I have tried on different networks, this problem is still persistent.
I have done a virus scan with clamxav, downloaded from app store, and have not found anything so far.
I don't have peerblock or any similar application installed, this is a fairly new computer.
I have reset my DNS and tried setting custom locations in network settings to no avail.
I have restarted the computer, no change. There is no change in the guest account even though there are basically no apps installed.
I have tried typing host www.hotmail.com into terminal and it returns:
www.hotmail.com is an alias for dispatch.kahuna.glbdns2.microsoft.com.
dispatch.kahuna.glbdns2.microsoft.com has address 65.55.157.147
dispatch.kahuna.glbdns2.microsoft.com has address 65.55.157.172
Which I think is normal
This was a problem with my previous macbook as well, please let me know if you have any suggestions. I have tried quite a few things but don't consider myself an expert by any means.
I appreciate any feedback or suggestions,
Thank youCould you post your diagnostics for us please?
In iTunes, go "Help > Run Diagnostics". Uncheck the boxes other than Network connectivity tests, as per the following screenshot:
... and click "Next".
When you get through to the final screen:
... click the "Copy to Clipboard" button and paste the diagnostics into a reply here. -
Quicktime on Windows clients can't open files in folders with long names!!
Hi,
we've got a really strange problem. We have an Intel Xserve with Leopard Server 10.5.4 which is sharing files over SMB. Everything works fine, except Quicktime on Windows clients (XP Pro and Vista). It looks like the length of the folder names is the problem. If a single folder in the path to the mov has a name that's longer than 8 characters, Quicktime fails with "Error -43: A file could not be found."
x:\test1234\test.mov works
x:\test12345\test.mov doesn't work
Same for UNC paths. VLC on Win and Quicktime on OS X work without problems over SMB. Also the problem doesn't exist on other Samba based fileservers.
Any ideas? Perhaps some smb.conf tweaks to fix this?
Best regardsJust found this post
http://discussions.apple.com/thread.jspa?threadID=1360461&tstart=0
Seems like a well known problem -
FrameMaker produces named destinations with random names
Hi all,
when I save a FM-document as PDF, the named destinations do not resemble the element IDs. Rather, the names of the destinations seem to be random numericals. This makes it impossible to link to the PDF from external HTML-documents without manually adjusting the links after each PDF-production.
Is there a way to control the names of the desitnations through output options etc.? This is a production from DITA/XML using Framemaker 7.2 and the DITA OT. Therefore we cannot just add markers in the Framemaker documents because these are generated new during each production run.Robert,
Unless you modify your procedure to insert markers, you're going to be out of luck. The only way to get FM to insert a destination that you can explicitly name and find is to use the newlink marker. You also need to be aware that FM will prepend some code characters to this as well depending upon whether the PDF is generated from a book or a standalone file.
Shlomo Perets' Timesavers tool gives you more control over inserting the named destinations. See http://www.microtype.com -
DVD Studio Pro crashes when accessing folders with mixed formats
DVD Studio Pro 4 on Mac Book Pro OSX 10.6.8
Program crashes whenever accessing my movies directory. It contains mostly HD content in MOV format. There are some MP4 and M4V in there too.
To check this I copied an MOV, MP4, and M4V into a separate directory. I added this folder to the Video tab of the Palette in DVDSP and same crash occurs until I remove all but MOV content.
Project setting is 1920 x 1080 HD. I have successfully imported several assets in MOV format.
My question is why would DVD Studio Pro crash just because it is pointed to a directory with mixed formats? Would it not just ignore to incorrect formats and move on? Why the crash if I am not trying to import them?I was going to let this go doc, but....
I discovered the crash by accident while doing Ripple Current training - yes I am a complete DVD SP newbie! Anyway my story: Oh look! There is an icon pointing at my Movies directory in the Video tab. Gee thats cool lets see what is in it. Ooooh s&*t the program just crashed! That can't be right, lets just try it again. Now thats just wrong! I'll beat this thing so lets experiment. Lo and behold its a mixed format problem. Why doesn't DVD SP just ignore any unrecognized formats like any other program? Hmm, being the newbie I am, and there was no hint in the Ripple training, I would ask the docs on the Apple forum. They will know why and what to do!
DVD SP seemingly by default maps my Movies directory. My Movies directory has multiple formats in it from years of use. I have movies for my iPhone, iPad, movies for Vimeo and iTunes, as well as other distribution formats in the same directory. I also have been experimenting with different codecs. My Movies directory has been used as an Internet distribution point. So please excuse me if I did not clean out my Movies directory before launching DVD SP! Little did I know this would even happen. If I could "unmap" this selection permanently I would - do you know how to do this? So far I cannot find any preference for it.
In a round-about way you got there, however so did I on my own - isolate the project to its own directory and NEVER pick on the "Movies" icon. I am not satisfied since it would be really nice to block this from ever happening again. God forbid an incorrect format should ever sneak into the sacred project directory "sorry but DVD SP and incorrect formats don't play nicely", so stop doing that! -
Accessing folders with absolute path having chars 256
Hi, while writing a program that recurses through the dirs and subdirs to find the size of folders tha abs path to the folder became > 256 chars and I got "can't access this folder; path is too long" message. please suggest any workaround for this problem except renaming the parent folders to shorten the path length.
I am working on Win2K and the part of code is :
for(int i = 0; i < listFolders.length; i++){ //throws NullPointerException here
if(listFolders.isDirectory()){
mytasks.add(listFolders[i]);
}else if(listFolders[i].isFile()){
size += (listFolders[i].length())/1000; //modified here- convert to KB
countFiles++;
if(listFolders[i].lastModified() > max){
max = listFolders[i].lastModified();
fileName = listFolders[i].getAbsolutePath();
Message was edited by:
ravishakya
Message was edited by:
ravishakya
Maybe you are looking for
-
When we go to different web pages, we get an onscreen message stating firefox has stopped working. Most of the time firefox does restore the pages and tabs, but sometimes it does not. How can we fix this problem? == Crash ID(s) == There are none.
-
Synching with more than one mac?
I want to synch my Touch with iCal and Address Book on more than one mac. Is there a way to do this? Can I somehow rename the iTunes on each mac the same name so it thinks all the macs are the same mac? Thanks.
-
How to digitize a physical book (scanned pfd file) to a kindle format with Indesign? pages are 8x11. I have all scanned pages, but the kindle format offered on the Indesign options is bigger. What should I do? Do I start a book from scratch with the
-
How to identify fact n diamension tables
hi, if i have logical data model with all PF-FK mentioned in it...and reports requirements docs with reports columns mentioned in it....now i need to identify fact n dimension tables in order to make star schema...can anyone tel me how to find it fro
-
However, it opens camera raw files from my D300 without problems. Same for Bridge: NEF files are displayed as generic thumbs. Can anyone help me?