Data Management API get the full folder path of the document - autodesk-data-management

when using https://developer.api.autodesk.com/data/v1/projects/:project_id/folders/:folder_id/search end point, I am receiving both deleted and non deleted documents.
I know there are post stating using included.attributes.hidden would resolve the issue, however I noticed If you delete the parent folder of the document, the document included.attributes.hidden still shows false (not deleted).
I am thinking of work around to get the document full hierarchy of the searched folder then cross check it with the document parents to know if the document is deleted.
Definitely going the recursive approach by calling parent of a parent till i reach the searched folder is not practical.
I need assistance in the following:
1- Is there a way to get the whole hierarchy under the searched folder.
2- Any other suggestion to know if a file is deleted.

After checking with engineer team, I got some comments:
It is as designed the documents/items are still hidden=false when the folder is deleted.
To dump whole hierarchy of folder, you may try with top folder and check subfolder recursively by GET:Folder Contents. Since GET:Folder Contents will tell if a folder is hidden or not, you could skip this folder (accordingly, skip the items inside the folder). By default, hidden items will not be returned. Finally build the folder & items tree.
If you search items by GET:Folder Search API, you would get those un-hidden items, yet its folder has been deleted, as you are experiencing. So you will have to double check if their folders are hidden or not. This means a tedious checking.
So I would suggest you build the tree from the top.

Related

How to undo move files from filezilla

I have one problem about filezilla. I accidentally move one folder to wrong directory, so it shows the errors when I view my website.
How can I solve it? Please help me.
Many thanks in advance for your answer.
You cannot undo, but you should understand why that happened and how to prevent that from happening again in the future.
This happened because Filezilla allows Drag-and-drop move functionality on both folders (directories) and files, very dangerous on production servers.
There is actually a feature-request for 11 years now, please add your vote to the list to get this done: https://trac.filezilla-project.org/ticket/2191
In the mean time, please consider using another software that allows the user to set this behavior as an option:
WinSCP: http://winscp.net/eng/docs/screenshots
WS-FTP Pro: https://trac.filezilla-project.org/attachment/ticket/2191/ws_ftp-professional-options.gif
EDIT: Filezilla team responded (sort of) to the feature request and you can block drag and drop in the xml config file. It's better than nothing.
You cannot undo ftp moves. The only way to rectify the problem is to manually move the folder to it's original location.
I suggest you be more careful from next time.
If you don't know where the folder belongs, download the x-cart script package and check where the directory belongs.
Sorry for late, but I am up to date. I get logs from filezilla of moved files.
Status: Renaming '/var/www/html/brb/abc.js' to '/var/www/html/brb/node_modules/abc.js'
Status: /var/www/html/brb/abc.js -> /var/www/html/brb/node_modules/abc.js
Status: Renaming '/var/www/html/brb/xyz.html' to '/var/www/html/brb/node_modules/xyz.html'
Status: /var/www/html/brb/xyz.html -> /var/www/html/brb/node_modules/xyz.html
I write script in js to build command
let x = ['/var/www/html/brb/abc.js -> /var/www/html/brb/node_modules/abc.js',
'/var/www/html/brb/xyz.html -> /var/www/html/brb/node_modules/xyz.html'];
let cmd = [];
x.forEach(p => {
let path = p.split('->');
cmd.push(`mv ${path[1]} ${path[0]}`);
})
console.log(cmd);
Output:
['mv /var/www/html/brb/node_modules/abc.js /var/www/html/brb/abc.js'
'mv /var/www/html/brb/node_modules/xyz.html /var/www/html/brb/xyz.html']
Use any editor like vscode etc and remove string quotes and execute command in server terminal etc
mv /var/www/html/brb/node_modules/abc.js /var/www/html/brb/abc.js
mv /var/www/html/brb/node_modules/xyz.html /var/www/html/brb/xyz.html
A simple answer is,
Copy the folder into the desired location and then delete from the current location where you moved it mistakenly.
Now, what if you overwrite a file.
I just edited a file in local, then downloaded the file from my server into the local, and my all the local updated data is gone. There seems no solution of this, but there may be one possibility, I may be the lucky enough that this is my case.
If you were working on that local file, so most probably it is opened in your browser. Do not refresh it. Copy the content one by one, and update the file again. You can also open developers tools of both old and new page. Compare them line by line and do the job.
I had the same issue and resolved it manually.
The log panel was helpful in this. It is the large panel below the connection form in the top menu.
From that log panel, I was able to figure out all the files which were moved with their current and previous location.
I copied those all log lines and paste them somewhere in notepad and then manually selected all files and move those all at once to their original directory.
Screenshot: The log panel showing last actions

Is Applescript processing new folders that are created in the moment the script runs?

I am working on a script that duplicates folders from an afp share to a local folder and does all kind of things with those folders afterwards. (it deletes the original folders after duplicating)
This code is working fine:
tell application "Finder"
duplicate every folder of folder afpFolder to localFolder with replacing
delete every folder of folder afpFolder
end tell
My problem is that our employees will be adding new folders to afpFolder regulary and quite often. My script is running every 10 seconds (with LaunchAgents) because it needs to process the duplicated data as often as possible.
The question I have is: What happens when the script is duplicating and deleting folders and in the exact same moment somebody adds a new folder to afpFolder?
Does the script only delete what was in afpFolder in the moment it started running or could it be that it would delete one of those newly created folders without duplicating it?
I have also thought about making something with a list. For example:
set folderList to {}
tell application "Finder" to set folderList to every folder of afpFolder
duplicate folderList to localFolder
delete folderList
(this might not work this way)
Can anyone please help me answer the question?
Can I work with the upper code where I just duplicate and delete? Or do I have to worry about the script deleting folders that are created in the moment the script runs, without duplicating them?
If the upper code can cause trouble, can you help me with the list solution?
The first script would delete items that are added between the duplicate and delete commands. But I can't think of any case where the second approach would not work:
tell application "Finder"
set l to items of ((POSIX file "/private/tmp/test") as alias)
duplicate l to desktop
delete l
end tell
You could also try using mv or rsync:
do shell script "mv /path/to/afp_folder/* /path/to/local_folder/"
do shell script "rsync -a /path/to/afp_folder/ /path/to/local_folder/
rm -r /path/to/afp_folder/*"
The code from your answer #John Alarik is inefficient and I think in some spots it won't even work. Please don't take that as a criticism because I can see you're trying hard to find a solution which is the right way to go about getting help. So I thought I'd help with your code.
First you seem to be doing many unnecessary conversions of strings, alias's, and file specifications. In addition some of them are incorrect in the context you are using them and will probably cause errors. Your repeat statement in overly complicated too.
Try this code. It works in the same manner as you want but is much cleaner and shouldn't have any errors. I hope it helps. Good luck.
set afpFolder to "examplepath:path:folder:" as alias
set localFolder to "examplepath:path:folder:" as alias
tell application "Finder"
set folderList to folders of afpFolder
repeat with aFolder in folderList
duplicate aFolder to localFolder with replacing
delete aFolder
end repeat
end tell
Don't make it more complicated than it needs to be.
Both Duplicate and Delete can accept a list as a direct parameter. There is no need for any repeat loops. Please note that this is the same format that Lauri suggested, just formatted with the OP's example. Give her the upvote.
set afpFolder to "examplepath:path:folder:" as alias
set localFolder to "examplepath:path:folder:" as alias
tell application "Finder"
set folderList to folders of afpFolder
duplicate folderList to localFolder
delete folderList
end tell
Update: See #regulus6633's post about this code!
Thanks for all the help. In the meantime I could solve my problem even without your answers due to a good code snippet I found for making and processing a list.
This is the final solution, which works fine even if you copy a new folder to afpFolder while the script is running.
tell application "Finder"
set afpFolder to "examplepath:path:folder:" as alias
set localFolder to "examplepath:path:folder:" as string
set folderList to every folder of folder afpFolder
set i to 1
repeat the count of folderList times
set afpUniqueFolder to (item i of folderList) as string
duplicate afpUniqueFolder to localFolder
delete afpUniqueFolder
set i to i + 1
end repeat
end tell
I know that there is also a command called move instead of duplicate and delete.
We had some strange issues with move before, so since then I stick to duplicate and delete.
Thanks to all! This website is very helpful!

Coldfusion CFC Mapping to external directories with CFCs that reference other folders

I've done some poking around and trial and error but I'm not coming up for a solution to this problem I have.
I have a folder structure like this (example)
Application.cfc
Objects\
Object.cfc
Utilities\
Util.cfc
API\
Resources\
index.cfm
Application.cfc
I have one site that points to the API folder (http://api.site.com) and another that points to the overall root (http://site.com)
From Api\Resource\index.cfm. I'm trying to createObject() on Objects\Object.cfc. I set up a mapping, either in CF Admin, or API\Application.cfc with this.mappings["/SiteRoot"] = "C:\wwwroot". Inside the index.cfm I do createObject("component","SiteRoot.Objects.Object"). This correctly access the Object.cfc.
The issue I'm having is that it fails because Object.cfc instantiates the Utilities\Util.cfc just by createObject("component","Utilities.Util"). The error is that Utilities.Util cannot be found.
There are other files in the very bottom root that can obviously call Object.cfc with no problems since it just goes into the Utilities folder naturally.
Any suggestions Or do I really need to just break the API Folder out of this root entirely?
Thanks!
UPDATE
It's not letting me answer my own question just yet but I wanted to post here before others chimed in.
Despite reiniting the application and restarting the application server, once or twice it wasn't working. Then suddenly, it just went and worked as I would have expected. Object.cfc could find Util.cfc correctly based on it's relative path.
I gave upvotes to those who responded as they were perfectly viable alternatives and solutions and would have gone with one of them had this not just started working. Demons, I tell you. Demons.
Thanks!
I think I would change your second create object call (the utilities one) to createObject("SiteRoot.Utilities.Util") ? Making sure that one mapping "governs" the starting point for all the objects no matter where instantiated.
If you really cannot change your code then just create a ColdFusion mapping called Utilities pointed at the Utilities folder.

Moving files in a verity collection

I have a collection of files which have been added to a verity collection. The filename, with complete path, has been used as the key.
I would like to move the location of the files on disk, but I am concerned that I will end up with duplicate entries (when I update the same file, the path to the file will be different, so I'll have an entry for the old file and an entry for the new one).
I wasn't involved with the original application setup, and I don't know much about verity or coldfusion (the rest of the app is in PHP). Can anyone suggest how I can go about running some sort of regex replace on each key in a verity collection, or possibly suggest another approach?
I would recommend to create new collection, adjust to your new specs (at least new path in your case) and swich to it in the application code (replace the collection name in cfindex/cfsearch).
After making sure it works properly you are free to delete the old one.
If you can not create collection for some reason, you can simply purge the collection, switch the path and re-index it.
Please note that you can do all of this directly from the application (maybe temporarily script) using cfcollection tag, and using CF Admin (see Verity Collections in menu) too.

Magento - locate specific core files

I am familiar with theming and using template hints in the Magento back office to locate .phtml files.
What I am not really familiar with are the core files such as app/code/core/Mage/Catalog/Model
What I need to do is override a core file like I would a core phtml file by copying it to 'my theme'.
I basically want to amend some labels which appear on the order summary page of the Magento checkout process - domain.com/checkout/cart/
I followed the trail to the phtml files using template hints. Within the app/design/frontend/default/mytheme/template/checkout/cart I found the code
renderTotals(); ?>
Now I managed, by accident, to stumble upon two of the files I wanted to change:
/httpdocs/app/code/local/Mage/Sales/Model/Quote/Address/Total/Grand.php
/httpdocs/app/code/local/Mage/Sales/Model/Quote/Address/Total/Shipping.php
I made local copies of these files (http://www.magentocommerce.com/wiki/how_to/how_to_create_a_local_copy_of_app_code_core_mage) to override the default labels, like I would if I was overriding a template file.
My question is, how can you locate core files which pertain to the 'stuff' you want to change, located in function calls such as renderTotals(); ?> in the phtml files?
Not being able to pinpoint stuff like I can with template hints is slowing me down, and I am struggling to find a solution as I am not up on all the vocab surrounding Magento yet.
Hope this makes sense and thanks in advance!
From the same settings page where you turn on Template Path Hints, also turn on the "Add Block Names to Hints" setting. This will show you PHP class names such as: Mage_Sales_Model_Quote_Address_Total_Grand to which you can deduce the folder path (underscores represent a subfolder, and the last piece represents the file name).
If you're getting a block such as Mage_Sales_Model_Quote_Address_Total_Default then sometimes it just takes a little common sense to see that it's pulling in other files from the same folder (such as Grand.php and Shipping.php). But there are generally only a couple files in the same folder, so this is pretty easy to see.
As Sid Vel said, a good Search Project functionality is helpful. But if you find yourself looking at Abstract.php of some class, often you need to look in a subfolder in that directory with the proper name to find the concrete implementations. But still, it gets you very close to where you need to be.
I always use Dreamweaver's site / directory search function. It will scan through all the files in the Core folder and tell you where the function is from. In your case, I would search for "renderTotals". You need to enable PHTML editing in Dreamweaver.
Most IDE's will allow this kind of search option. In Aptana you can Ctrl + Click on the function to open the file it is coming from. Magento takes ages to index itself on Aptana, due to its sheer size.