Programmatically file one folder under another folder in FileNet P8 - filenet-p8

I have a folder called 'Top' and 2 sub folders 'A' and 'B' underneath that. Now, I'm trying to move folder 'B' under folder 'A'. For this, I tried a create a RCR as follows..
RCR = FolderA.File((IFolder)FolderB, AutoUniqueName.AUTO_UNIQUE, ((IFolder)FolderB).Name, DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
Though this code executes without any error, I don't see Folder B moving under Folder A. Wondering is this the right way?

I found that we have to just set the parent property and no need of RCR

Related

auto squencentially rename files based on last, numbered, file in folder and move to that location

I am looking for suggestions on how to automatically monitor a folder for uploads (pictures only) and move them into another with a specific filename "MyLife" in the prefix and a numbering sequence in the suffix. I store all my pictures in \Documents\Photos\MyLife and they are numbered with digits i.e. MyLife5523.jpg I would like to monitor a folder \Documents\picsupload for images and have a script or program to check \Documents\Photos\MyLife for the last existing file name (number) and rename the image to the next sequential number and move to \Documents\Photos\MyLife
i.e.
\Documents\picsupload has IMG_20170313_123003.jpg, IMG_20170318_123003.jpg, and IMG_20170313_123030.jpg
The program/script checks \Documents\Photos\MyLife and finds the last file is MyLife5523.jpg
IMG_20170313_123003.jpg, IMG_20170318_123003.jpg, and IMG_20170313_123030.jpg are renamed to MyLife5524.jpg, MyLife5525.jpg, and MyLife5526.jpg and moved to \Documents\Photos\MyLife
I currently have AutoHotKey and DropIt installed. However, I'm open to other suggestions.
Respectfully,
JA
Use SetTimer to poll the source directory for files using Loop, FilePattern. When found, use FileMove to move and rename them into your destination folder. Use IniWrite and IniRead to save numeric suffix so you don't have to scan the destination folder every time.

How to delete a file in UFT?

I am access files in a folder through a for loop lie this
For Each f in re.files
If .... Then
--Here I want to delete the file f
How do I delete that file f? I dont need to do it inside the loop, I can refer to it outside and delete
Given a file object (via .GetFile or loop over .Files), use its .Delete method. If you have a path (string), consider to use the .DeleteFile method of the FileSystemObject.

Search for a folder only for a certain level (3 sub directories only)

Currently I am searching for a '.svn' folder inside a path using the below code :
require 'find'
svn_folders = []
#folder_path = 'C:\my_repositories\'
Find.find(#folder_path) do |path|
svn_folders << path if path =~ /.*\.svn$/
end
The above code will search all the folders inside #folder_path and lists me with the svn_folders path.
But, the big problem is that these folders are a big (50GB +) so searching for the '.svn' folder takes a lot of time to search.
Question : Is it possible to search only for certain level of sub folders, 3 sub folders in my case?
Example :
If my folder path is C:\my_repositories
I would like to search 3 layers (sub folders) down i.e, till C:\my_repositories\project_name\repository_name\repository
and would not like to search beneath the folder named repository.
Any suggestions would be really helpful. Thank you very much in advance.
Isn't it just
Dir.glob("*/*/*/.svn")

Accessing a hidden share programmatically in VB.net

I have a simple method to move a folder to a new directory
Dim firstshare As String = "\\myshare\users\" & frmDeparture.txtUsername.Text
Dim destination As String = "\\secondshare\userarchives$\" & frmDeparture.txtUsername.Text
Try
If Directory.Exists(firstshare) Then
Directory.Move(firstshare, destination)
MsgBox("Folder moved from \\firstshare\users")
End If
Catch ex As Exception
MsgBox("Error finding folder")
End Try
This works fine if I set "destination" as a path like "\path\whatever", but if it's a hidden path (with the $) it doesn't work. Is there something special I have to do in order to access a hidden share programatically?
You are most likely trying to move a directory from one volume/partition to another, and you are getting this error :
Source and destination path must have identical roots. Move will not
work across volumes
An explanation of why this is not possible is found Here. The only way you could move directories across different volumes is to create a new directory in the destination volume and copy the files from the source. You could then delete the original files if you wish.

programmatically updating iTunes track location

I would like to modify the filesystem path for tracks on itunes programmatically, so that I can apply a string transformation to some of the tracks locations (which are now stored in a different places on the filesystem).
I've tried using AppleScript to update the location property of the relevant tracks but I get an end-of-file error when calling "set mytrack's location to ..."
I've seen various other hacks online that involve exporting the entire track db, modifying it in XML, and then reimporting it - but that seems to lose too much metadata (such as playlists).
It would really help to see more of your code. Of particular interest is the value you are using and how it is derived. It would also be useful to see the exact error message you get (you should be able to copy the text out of the AppleScript error dialog sheet if you are running the program from Script Editor/AppleScript Editor).
The dictionary entry for the file track class shows its location property being a writable alias value. The problem you are probably running into is that you are not using an alias for the value.
The following code shows how one might change a track's location using an interactive prompt from choose file (which returns an alias):
set m to path to music folder
tell application "iTunes"
set trk to first item of selection
set l to location of trk
if class of l is alias then
set m to l
end if
set {d, a, n} to {database ID, artist, name} of trk
choose file with prompt "Choose the file to use for " & d & ": " & a & "—" & n default location m
set location of trk to result
end tell
The choose file method is not what you want though, since you are doing some kind of automated, string based pathname translation.
When working with pathnames in AppleScript, there are two kinds that you might use: POSIX and HFS. POSIX pathnames have slash delimited components (and allow colons inside any component). HFS pathnames have have colon delimited components (and allow slashes inside any component), and they usually start with a volume name component.
To convert a POSIX pathname stored in a variable str to an AppleScript alias, use the following expression:
POSIX file str as alias
To convert an HFS pathname stored in a variable str to an AppleScript alias, use the following expression:
alias str
For example:
tell application "iTunes"
set trk to first item of selection
set l to location of trk
set newPath to my computeNewPath(POSIX path of l)
set location of trk to POSIX file newPath as alias
end tell
to computeNewPath(pp)
-- presumably something interesting happens here
return pp
end computeNewPath
How to move media files (that are not "organized" by iTunes) to a different location while keeping the iTunes library database (iTunes Library.itl) intact:
Move files to new location (e.g., mv ~/MyMusic /Volumes/Huge/)
Create symlink in old location pointing to new location
(ln -s /Volumes/Huge/MyMusic ~/MyMusic)
Start iTunes (if not already running)
Select all tracks that were moved.
Run this AppleScript:
-- Mark missing tracks (and update database with real path of existing
-- tracks) in iTunes
-- Instructions:
-- * symlink new file location to old location (old location points to
-- new location, file exists)
-- * select tracks to scan/update
-- * run the script
-- * missing tracks are marked with (!) and all other track paths have
-- been updated to the real path (symlinks eliminated) in iTunes
tell application "iTunes"
set fx to fixed indexing
set fixed indexing to true
set Sel to the selection
repeat with i from 1 to number of items in Sel
set trk to item i of Sel
set loc to (get location of trk as text)
end repeat
set fixed indexing to fx
end tell
All tracks should now point to the correct location, and the symlink(s) can be removed. This can be verified by selecting Get Info on a track that was moved and verify that the path points to the new location.
If you didn't get the symlink correct iTunes will display (!) beside each missing track. To fix the issue, simply create a symlink in the old location pointing to the new location and run the script again. Hint: the Get Info dialog can be used to determine the old location of a missing track.
This worked on iTunes 11.0.5
Adding to the previous answer by millerdev I updated the script to work with MacOS Catalina and the new Music app. Just create a $HOME/Library/Music/Scripts directory and place it there.
tell application "Music"
set fx to fixed indexing
set fixed indexing to true
set Sel to the selection
repeat with i from 1 to number of items in Sel
set trk to item i of Sel
set l to location of trk
set location of trk to l
end repeat
set fixed indexing to fx
end tell

Resources