Creating A Log Of Files In A Folder and update into table - database

Can anyone help me to build a table that lists all files in a specified folder, so whenever a file is copied to that folder the table should update and make a log of files?
I need the list to retain the names, even if the file is moved from that folder or deleted. Later the data would be deleted by a scheduler.
Also I need the table to record the time exactly when the file was copied into that folder and not the modification or creation time.
I am using windows 7; how can I build a system with my desired behaviour?

Just turn on Windows file auditing, for that folder, the youtube video takes you through the process.
Microsoft provide information on their techNet site as to how you can use the LogParser tool to extract Security events from the Event Log DB.
Note: Admin questions should really be posted to the SuperUser site.

Related

VB.NET Copying Database template files to selected folder location during installation

net project as well as a setup project. I also have it so that during installation it asks the users to enter a file location to store their database. the plan is to have an empty .mdf file, with all the tables setup, copied into that folder and I store the folder path in a config file.
this is mainly because I am planning on having multiple separate applications that all need the ability to access the same database. I have it storing the folder path in my config file the only thing I'm having trouble with is
storing the template files I don't know if i should do this in the setup project or main project
how to copy said template files into a new folder
so far I have been unable to find a solution so any help is appreciated
Well here is what I do this in a few of my projects - something that has proven reliable enough for me over the years (which you may or may want to do as well):
I have the program itself create the database files in an initialization routine. First however, it creates the sub folders in which the database files will be stored, if they don't already exist.
To do this, the program just checks if the folder exists and if the database file exists and if they do not, it creates them on the spot:
If Directory.Exists(gSQLDatabasePathName) Then
Else
Directory.CreateDirectory(gSQLDatabasePathName)
End If
If File.Exists(gSQLiteFullDatabaseName) Then
Else
...
I also have the program do some other stuff in the initialization routine, like creating an encryption key to be used when storing / retrieving the data - but that may be more than you need (also, for full disclosure, this has some rare issues that I haven't been able to pin down).
Here too are some addition considerations:
I appreciate you have said that you want to give the user the choice of where to store their database files. However, I would suggest storing them in the standard locations
Where is the correct place to store my application specific data?
and only allowing the users to move them if the really need to (for example if the database needs to be shared over the network) as it will make the support of your app harder if every user has their data stored in different places.
I have found letting the user see in their options/settings windows where their database is stored is a good idea.
Also to encourage them to back those files /directories up.
Also to create automatic backups of several generations for the user.
Hope this helps.

Woocommerce_log too big database folder

I can't find answers to my question so I'm doing it. My site's database occupies 10.9 Gb of which 10.5 is the woocommerce_log folder, what can I do?? Can older logs be deleted? Is there a problem with the configuration?
Folder and Database are 2 different things.
10.5 is the woocommerce_log folder
You've mentioned folder but wrote the table name so it's confusing if you're talking about folder or database table.
however, if you are talking about the folder with the path wp-content/uploads/wc-logs then yes you can delete all the files with the extension .log
if you're talking about database table wp_woocommerce_log then generally it should be empty unless your log handler is set to DB. you can empty data from this table as well. but don't delete the table.
You also need to look in wp-config.php if you have defined a logger using constant WC_LOG_HANDLER you should use a file logging system instead of DB.
You can find more details on the WooCommerce logger on this page. https://developer.woocommerce.com/2017/01/26/improved-logging-in-woocommerce-2-7/
post_meta (in WordPress or WooCommerce) is inefficiently indexed. Suggest you add this plugin: WP Index Improvements
More discussion: http://mysql.rjweb.org/doc.php/index_cookbook_mysql#speeding_up_wp_postmeta
(Deleting unused data from any big table rarely helps as much as improving the indexes.)

Merging a folder in SVN records only the folder in the log, and not the files inside it

The scenario is as follows.
We're running a CI server which scans a repository for any .sql changes, then executes them against a target database.
Currently it's failing because SVN is not recording file changes within a folder (that has been merged from a branch). Merge info was commit too.
Example:
Developer branches "/Trunk" to "/Branches/CR1"
Developer adds a new folder "CR1/Scripts"
Developer adds two new files "Scripts/Script1.sql" and "Scripts/Script2.sql"
Developer commits the folder and files together
Developer merges from CR1 to Trunk, commit dialog displays status "Normal"
CI server detects no changes
Developer examines the log and sees no mention of Script1.sql or Script2.sql
All this is displayed via TortoiseSVN on Windows, the CI Server is using SharpSvn .NET library.
Any help figuring out how to get the *.sql files to show up would very much be appreciated.
It's nearing a year, and during this time we've used a workaround to find the missing files. Using the CLI command svn log -v we scanned for any directory with the COPY-FROM-PATH text and listed the contents from that directory on disk rather than SVN.
Whilst this does provide us with a full list of files in that folder, we should really be able to get this info remotely without checking out a copy of the repository. When a co-worker also encountered this issue recently they found the the answer courtesy of the IRC channel #svn on freenode.
Using the CLI command svn diff <url>[old rev] <url>[new rev] --summarize you get a difference between the revisions which thanks to the --summarize flag displays all the files and which finally answered the original question.

Best file permission for users to upload and delete files and folders

Lets say I let people upload files on the server. Should I change the file name s
after the upload ? if yes, how can I tell the about the file names later on , beacause in CMS I need tpo provide them with the url to images or doc files etc so they refer to them while producing text for the website.
I coded a program with which my users can navigate through some files and folders
they can create folders and upload files of any extension inside the mentioned folders
. Unfortinately my code creates all files and foldes with 777 permission. I wanna know
What would happen if someone uploads a .php file inside a folder and runs it. Can he/she
Delete every possible thing ? May you help me with right permission I should give to those files
and folders. The uploader should know about the url where he/she has uploaded
the image so while creating some content he can refer to them as url for images or
office word documents. Please help me with security hole.
Thank you.
I suggest you create some database table as a reference to those file so that you can record the old name, and changing the name in file system to different one so that you will never overwrite an existing file with same name.Or you can even same file in DB instead of file system.
First thing is you should not allow user upload any executable files to your server, or at least you need to change the extension name to something else I think. And I don't think 777 is needed, you just need to make sure the folder r/w to the php/web server processor and that's should be enough for any user access them

Reading Properties of all Files existing in one of the folders on Application Server and print on a JSP

I have to read the Name and Creation Date/Last Modified Date of all the files that may exist on /product/xyz folder, existing on JBoss Application Server and print the same on JSP.
This folder is being loaded with the fresh files when server is booted. The framework used is Struts 1.2.
Any hints or examples around how to read these information and print on JSP? Thanks!
EDIT :
I understand that it is much easy to read the files from a folder which might be part of my workspace folder. But, this is a different scenario.
Here, the JSP file will be deployed on JBoss application server, in some ABC folder, as part of some EARs. On the same application server, there is some other XYZ location, which will be loaded with the fresh files, when server is booted. I want to read the files existing in that XYZ folder. I Hope the scenario is more clear now.
The code doesn't change whether I try to access the files from my Work Space folders (Rather, which are to be part of EARs) or I may access from the Server File System (Outside the EARs).
The issue could be there in Path Mentioned or the Permission (Read/Write) to the Folder from which the files are being read.

Resources