Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


How To Find a large file or folder in Azure Websites

It’s no secret that I love to build Dnn sites in Azure Websites.   I’ve posted on how to install Dnn on Azure Websites, Launch a Dnn site on Azure Websites  and how to Move an existing Dnn installation to Azure Websites.  These three articles are all you need to get up and running fast and to start to delve into some of the other great features.

Assuming you’ve followed some of these instructions, you might find yourself faced with a task that is ordinarily simple when using a traditional hosting environment, but suddenly becomes tough.

I came across one of these the other day – the file usage had jumped all of a sudden – but where was the issue? 

In Windows, I’d just run a search and sort by size, or maybe do a search for files over a specific size.  But there is no option to do that in Azure Websites.  Another approach is needed.

Finding large Files in an Azure Website

The key to doing this task is using Visual Studio Online – you need to first activate this for your Website before you can use it.

If you need to add the extension, use the new Azure Portal to go to your Website, choose Extensions, and then add Visual Studio Online as an extension.

Add Visual Studio Online Extension

Note that running Visual Studio Online does take up some of your available resources so if you’re not going to use it for a long time you can disable it again.

Once it’s been added, you can then browse to the Visual Studio Online URL and open the editor.

The editor will load in a new window, and show a list of files/folders for your site.  Any file you click on is edited and saved immediately – so don’t start messing with things for fun and be careful.

One thing you’ll notice is that the file/folder list doesn’t include any file sizes.  So that’s not going to help us find a big file if we don’t know what we are looking for.

However, we do have access to the ‘console’ which is a DOS-like console app.  I say DOS-like because there is only a subset of resources.  Happily the evergreen dir command is available, and it gives us files – in byte size, mind you, harking back to the days when files generally did consist of bytes and not gigabytes.

Here is where it gets fun.  What we are going to do is combine the dir command with redirected output to a text file, then use the native Visual Studio Online file editor to find the big ones.  It’s easy to do:

Step 1 : Issue this command in the command prompt : dir *.* /s > filelist.config

This does a recursive listing of all files and redirects the output to a text file, which we are calling filelist.config.  Why end the file with .config?  Because that is a reserved file extension that ASP.NET will not serve if requested – it wouldn’t be a good idea to dump a listing of our files into ‘files.txt’ which might be easy to request from the server.

Step 2 : Find the filelist.config file in Visual Studio Online and click on it, so it opens in the editor

Step 3 : Find the big files by using the ‘Find’ function with a regex filter.

You can open the ‘find’ function with Ctrl-F in the browser while the filelist.config file is opened in Visual Studio Online.  Click on the little regex icon [.*] in the find popup, then write your Regular Expression:

  • To find files of 10 Mb or more :  \d{2,3},\d{3},\d{3}
  • To find files of 1GB or more : \d{1,3},\d{3},\d{3},\d{3}
  • To find files of 10GB or more :  \d{2,3},\d{3},\d{3},\d{3}

This works by matching the comma separated thousands in the directory output.   Remember that 1 Megabyte = 1,000,000 Bytes and 1 Gigabyte = 1,000,000,000 Bytes.  To find the right size, it’s just a case of matching the commas and digits, which is what the above patterns do.

The large file is highlighted (ok, so I intentionally put it there so it would show up).  The regex pattern in the search box is shown on top of the image.

Step 4 : Deal with the big files.

Using this process, I’m quickly able to identify where big files and folders are in the installation.  This leads me directly to a 313 Megabyte file in my ‘downloads’ folder.  Now I can easily fix that issue by deleting the oversized file and every thing is OK.   Note that this process also works for folders because the DOS ‘dir’ command also summarizes the size of each folder it iterates through.

If you try this out, don’t forget to delete your ‘filelist.config’ file at the end of the process – no need to waste disk space with a static copy that will soon be out of date.

Hope this helps someone with an inexplicable increase in storage so they can find big files and start trimming them down.

Comments

Horacio Judeikin
Being DNN Sites, perhaps it would be easier to simply install DNNBackup and browse to Tools > File System Folders size analysis
Horacio Judeikin Wednesday, March 4, 2015 12:27 PM (link)

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out